美文网首页
babel 7.X变化

babel 7.X变化

作者: 7cf6c01a5633 | 来源:发表于2018-10-20 18:35 被阅读0次
    1. 使用npm的scope包@balbel/xxx
    2. 所有阶段预设state-x均已弃用,使用plugin代替
    {
      "plugins": [
        // Stage 0
        "@babel/plugin-proposal-function-bind",
     
        // Stage 1
        "@babel/plugin-proposal-export-default-from",
        "@babel/plugin-proposal-logical-assignment-operators",
        ["@babel/plugin-proposal-optional-chaining", { "loose": false }],
        ["@babel/plugin-proposal-pipeline-operator", { "proposal": "minimal" }],
        ["@babel/plugin-proposal-nullish-coalescing-operator", { "loose": false }],
        "@babel/plugin-proposal-do-expressions",
     
        // Stage 2
        ["@babel/plugin-proposal-decorators", { "legacy": true }], //解析装饰器
        "@babel/plugin-proposal-function-sent",
        "@babel/plugin-proposal-export-namespace-from",
        "@babel/plugin-proposal-numeric-separator",
        "@babel/plugin-proposal-throw-expressions",
     
        // Stage 3
        "@babel/plugin-syntax-dynamic-import",
        "@babel/plugin-syntax-import-meta",
        ["@babel/plugin-proposal-class-properties", { "loose": false }],
        "@babel/plugin-proposal-json-strings"
      ]
    }
    
    1. @babel/polyfill是@babel/runtime-corejs2的别名
    {
      "presets": [
        ["@babel/preset-env", {"useBuiltIns": "usage"}]
      ],
      "plugins": [
        ["@babel/plugin-transform-runtime",{"corejs": 2}]
      ]
    }
    

    参考

    babeljs 6.x
    babeljs 7.x
    关于babel 的一些包理解7.X版本

    相关文章

      网友评论

          本文标题:babel 7.X变化

          本文链接:https://www.haomeiwen.com/subject/stymzftx.html