A Rollup plugin that injects core-js polyfills based on browserslist configuration. Current stable version is 1.0.2, supporting Rollup 3 and 4. It acts as a wrapper around core-js-builder, enabling polyfill injection without Babel. Key differentiator: similar to Babel's useBuiltIns: 'usage' option, it can detect which APIs are used in your code and include only those polyfills, reducing bundle size. Enforces Node >=20. ESM-only module, ships TypeScript types. Release cadence is low, with occasional dependency updates.
npm install rollup-plugin-corejsVerified import paths — ran on the pinned version, not inferred.
Shows basic Rollup configuration using the plugin with core-js/es modules and usage-based polyfill detection.
If third-party polyfills are needed, consider adding them separately or using a different strategy.
Remove the summary option from plugin configuration.
Upgrade to Rollup 4 as soon as possible.
Upgrade Node.js to version 20 or later.
Rename rollup.config.js to rollup.config.mjs or use top-level await with dynamic import.
Use import { corejsPlugin } from 'rollup-plugin-corejs' in your Rollup config, or rename the file to .mjs.Use destructuring: const { corejsPlugin } = await import('rollup-plugin-corejs') or ESM import.Ensure core-js is installed as a dev dependency: npm install -D core-js