以最新版本 7.5.0为准
安装
npm install --save-dev @babel/core @babel/cli @babel/preset-env
npm install --save @babel/polyfill
运行时依赖安装
@babel/polyfill 模块包括 core-js 和一个自定义的 regenerator runtime 模块
npm install --save @babel/polyfill
这个@babel/preset-env套餐几乎能做一切事情,包括处理 polyfills:
this option configures how @babel/preset-env handles polyfills.
useBuiltIns: 'entry'
NOTE: Only use require("@babel/polyfill"); once in your whole app. Multiple imports or requires of @babel/polyfill will throw an error since it can cause global collisions and other issues that are hard to trace. We recommend creating a single entry file that only contains the require statement.
This option enables a new plugin that replaces the statement import "@babel/polyfill" or require("@babel/polyfill") with indi