{"id":21969,"library":"rollup-plugin-corejs","title":"rollup-plugin-corejs","description":"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.","status":"active","version":"1.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/susnux/rollup-plugin-corejs","tags":["javascript","corejs","core-js","polyfill","polyfills","rollup","rollupplugin","rollup-plugin","browserslist","typescript"],"install":[{"cmd":"npm install rollup-plugin-corejs","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-corejs","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-corejs","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency, required as the plugin host","package":"rollup","optional":false}],"imports":[{"note":"Package is ESM-only; CommonJS require is not supported.","wrong":"const corejsPlugin = require('rollup-plugin-corejs')","symbol":"corejsPlugin","correct":"import { corejsPlugin } from 'rollup-plugin-corejs'"},{"note":"In dynamic import scenarios, use await import.","wrong":"const { corejsPlugin } = require('rollup-plugin-corejs')","symbol":"corejsPlugin","correct":"const { corejsPlugin } = await import('rollup-plugin-corejs')"},{"note":"Options type is not exported as a value, only type.","wrong":"import { Options } from 'rollup-plugin-corejs'","symbol":"corejsPlugin (type import)","correct":"import type { Options } from 'rollup-plugin-corejs'"}],"quickstart":{"code":"import { corejsPlugin } from 'rollup-plugin-corejs';\nimport { defineConfig } from 'rollup';\n\nexport default defineConfig({\n  input: 'src/index.js',\n  plugins: [\n    corejsPlugin({\n      // Use polyfills for ES features only\n      modules: 'core-js/es',\n      // Only include polyfills for APIs used in your code\n      usage: true,\n      // Optionally specify targets (defaults to browserslist)\n      targets: '> 0.5%, not dead'\n    })\n  ],\n  output: {\n    file: 'dist/bundle.js',\n    format: 'es'\n  }\n});","lang":"typescript","description":"Shows basic Rollup configuration using the plugin with core-js/es modules and usage-based polyfill detection."},"warnings":[{"fix":"If third-party polyfills are needed, consider adding them separately or using a different strategy.","message":"Usage-based polyfill detection only analyzes your own code, not third-party dependencies.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Remove the summary option from plugin configuration.","message":"v1.0.0 removed the 'summary' option. Using it will throw an error.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Upgrade to Rollup 4 as soon as possible.","message":"Rollup 3 support is deprecated; future versions may only support Rollup 4.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Upgrade Node.js to version 20 or later.","message":"Node.js version must be >=20.0.0. Older versions will fail to load the plugin.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Rename rollup.config.js to rollup.config.mjs or use top-level await with dynamic import.","message":"The package is ESM-only. If your Rollup config uses CommonJS, you must migrate to ESM or use dynamic import.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.2':22 '20':72 '3':25 '4':27 'act':29 'api':56 'around':33 'babel':42,47 'base':14 'browserslist':16,100 'builder':37 'bundl':68 'cadenc':81 'code':61 'configur':17 'core':11,35,91 'core-j':10,90 'core-js-build':34 'corej':4,89 'current':18 'depend':86 'detect':54 'differenti':44 'enabl':38 'enforc':70 'esm':74 'esm-on':73 'includ':63 'inject':9,40 'javascript':88 'js':12,36,92 'key':43 'low':83 'modul':76 'node':71 'occasion':85 'option':51 'plugin':3,7,99 'polyfil':13,39,66,93,94 'reduc':67 'releas':80 'rollup':2,6,24,95,98 'rollup-plugin':97 'rollup-plugin-corej':1 'rollupplugin':96 'ship':77 'similar':45 'size':69 'stabl':19 'support':23 'type':79 'typescript':78,101 'updat':87 'usag':50 'use':58 'usebuiltin':49 'version':20 'without':41 'wrapper':32","created_at":"2026-04-27T17:02:42.854489+00:00","updated_at":"2026-04-27T17:02:42.854489+00:00","problems":[{"fix":"Use import { corejsPlugin } from 'rollup-plugin-corejs' in your Rollup config, or rename the file to .mjs.","cause":"The package is ESM-only but imported using require() in a CommonJS context.","error":"ERR_REQUIRE_ESM: require() of ES Module from rollup-plugin-corejs not supported."},{"fix":"Use destructuring: const { corejsPlugin } = await import('rollup-plugin-corejs') or ESM import.","cause":"Improper import or destructuring, e.g., const corejsPlugin = require('rollup-plugin-corejs') returns the module object, not the function directly.","error":"TypeError: corejsPlugin is not a function"},{"fix":"Ensure core-js is installed as a dev dependency: npm install -D core-js","cause":"core-js-builder is a dependency of the plugin, but it may fail to resolve in some environments.","error":"Error: Cannot find module 'core-js-builder'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/susnux/rollup-plugin-corejs","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/rollup-plugin-corejs","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops","web-framework"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-18","next_check":"2026-07-26","install_tag":null}}