babel-plugin-polyfill-corejs3

中文文档
1.0.0发布于 2026/06/18MITES Module近 30 天下载 2.4亿

A Babel plugin to inject imports to core-js@3 polyfills

原始使用文档
文档目录5 节
  1. Install
  2. Usage
  3. Options
  4. version
  5. proposals

babel-plugin-polyfill-corejs3

Install

Using npm:

npm install --save-dev babel-plugin-polyfill-corejs3

or using yarn:

yarn add babel-plugin-polyfill-corejs3 --dev

Usage

Add this plugin to your Babel configuration:

{
  "plugins": [["polyfill-corejs3", { "method": "usage-global", "version": "3.48" }]]
}

This package supports the usage-pure, usage-global, and entry-global methods. When entry-global is used, it replaces imports to core-js.

Options

See here for a list of options supported by every polyfill provider.

version

string, defaults to "3.0".

This option only has an effect when used alongside "method": "usage-global" or "method": "usage-pure". It is recommended to specify the minor version you are using as [email protected] may not include polyfills for the latest features. If you are bundling an app, you can provide the version directly from your node modules:

{
  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
    }]
  ]
}

If you are a library author, specify a reasonably modern core-js version in your package.json and provide the plugin the minimal supported version.

{
  "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, defaults to false.

This option only has an effect when used alongside "method": "usage-global" or "method": "usage-pure". When proposals are true, any ES proposal supported by core-js will be polyfilled as well.

版本与发布记录

babel-plugin-polyfill-corejs3 共发布 58 个版本,首次发布于 2020/04/08;过去 12 个月发布了 6 个版本。

版本发布日期距今
1.0.0latest2026/06/184 个月前
1.0.0-rc.2next2026/04/116 个月前
1.0.0-rc.12026/04/116 个月前
0.14.22026/03/177 个月前
0.14.12026/03/078 个月前
0.14.02026/01/249 个月前

关于 babel-plugin-polyfill-corejs3 的常见问题

babel-plugin-polyfill-corejs3 是什么?

A Babel plugin to inject imports to core-js@3 polyfills

如何安装 babel-plugin-polyfill-corejs3?

在项目目录运行 npm install babel-plugin-polyfill-corejs3,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@babel/core(^7.4.0 || ^8.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

babel-plugin-polyfill-corejs3 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/babel-plugin-polyfill-corejs3 是否存在。

babel-plugin-polyfill-corejs3 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

babel-plugin-polyfill-corejs3 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js ^20.19.0 || >=22.12.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

babel-plugin-polyfill-corejs3 可以商用吗?

babel-plugin-polyfill-corejs3 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

babel-plugin-polyfill-corejs3 的下载量有多少?

根据 npm 官方下载统计,babel-plugin-polyfill-corejs3 在 2026/10/05 – 2026/11/03 这 30 天内被下载 240,279,424 次,日均约 8,009,314 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

babel-plugin-polyfill-corejs3 还在维护吗?

最新版本 1.0.0 发布于 2026/06/18(4 个月前);至今共发布 58 个版本,其中过去 12 个月发布了 6 个;首次发布于 2020/04/08。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。