如何在巴别7中使用babel-polyfill?

问题描述 投票:0回答:1

现在,@babelpolyfill主要是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似乎不能用了,现在@babelpolyfill主要是core-js v2的别名。

babel babel-polyfill
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.