如何在Babel 7中使用babel-polyfill

时间:2020-06-08 05:36:06

标签: babeljs babel-polyfill

现在@ babel / polyfill只是core-js v2的别名

.babelrc

{
  "presets": [
    [
      "@babel/env",
      {
        "useBuiltIns": "usage",
        "targets": {
          "ie": "11",
          "edge": "17",
          "firefox": "60",
          "chrome": "67",
          "safari": "11.1"
        },
        "corejs": { "version": 3, "proposals": true }
      }
    ],
    "@babel/preset-react"
  ],
  "plugins": [
    "react-hot-loader/babel",
    ["@babel/plugin-proposal-decorators", { "legacy": true }],
    "@babel/plugin-proposal-class-properties",
    "@babel/plugin-transform-modules-commonjs"
  ]
}

包含在app.js中

import 'core-js/stable';
import 'regenerator-runtime/runtime';

进行了这些更改之后,polyfill似乎无法正常工作。

0 个答案:

没有答案
相关问题