贝贝-插孔-多肽-核心js3
安装
使用 npm :
npm install --save-dev babel-plugin-polyfill-corejs3
或使用线条 :
yarn add babel-plugin-polyfill-corejs3 --dev
使用量
将此插件添加到您的 Babel 配置 :
{
"plugins": [["polyfill-corejs3", { "method": "usage-global", "version": "3.48" }]]
}
此软件包支持 usage-pure, (中文(简体) ), usage-global,以及 entry-global 方法。 。 .
何时 entry-global 它取代进口到 core-js。 。 。 .
选项
见 这里 对于每个多填充提供者支持的选项列表.
version
string,默认为 "3.0"。 。 。 .
此选项仅在同时使用时有效果 "method": "usage-global" 或者说 "method": "usage-pure"建议指定您所用的小版本 [email protected] 可能不包括最新特性的多填充。 如果您正在捆绑一个应用程序, 您可以直接从节点模块中提供该版本 :
{
plugins: [
["polyfill-corejs3", {
"method": "usage-pure",
// use `core-js/package.json` if you are using `usage-global`
"version": require("core-js-pure/package.json").version
}]
]
}
如果您是图书馆作者,请指定一个合理的现代 core-js 在您的版本中
package.json ,并提供插件最小支持的版本.
{
"dependencies": {
"core-js": "^3.48.0"
}
}
{
plugins: [
["polyfill-corejs3", {
"method": "usage-global",
// improvise if you have more complicated version spec, e.g. > 3.1.4
"version": require("./package.json").dependencies["core-js"]
}]
]
}
proposals
boolean,默认为 false。 。 。 .
此选项仅在同时使用时有效果 "method": "usage-global" 或者说 "method": "usage-pure"时 proposals 为: true由核心J支持的ES提案也将被多层填充.