rollup-plugin-babel-runtime-external

raw JSON →
2.0.0 verified Sat Apr 25 auth: no javascript maintenance

Rollup plugin (v2.0.0, last released 2017, no recent updates) to automatically mark babel-runtime modules as external during bundling. Purpose: avoid duplicating babel helpers/polyfills when using @babel/runtime. Requires peer dependencies babel-runtime >=6.25.0 and rollup >=0.45.2. Differentiator: simplifies rollup config by auto-detecting babel-runtime imports vs manual external list.

error Cannot find module 'rollup-plugin-babel-runtime-external'
cause Package not installed or not in node_modules
fix
Run npm install --save-dev rollup-plugin-babel-runtime-external
error Error: 'default' is not exported by rollup-plugin-babel-runtime-external
cause Using named import { babelRuntimeExternal } instead of default import
fix
Use import babelRuntimeExternal from 'rollup-plugin-babel-runtime-external' (default export)
error The 'babel-runtime' package is not marked as external
cause Plugin not added to rollup config's plugins array
fix
Add babelRuntimeExternal() to plugins array in rollup.config.js
error RollupError: Could not resolve 'babel-runtime/helpers/extends'
cause Plugin not applied or options misconfigured
fix
Ensure plugin is included and options match your babel-runtime usage
breaking Requires rollup >=0.45.2 and babel-runtime >=6.25.0
fix Update rollup and babel-runtime to meet peer dependency versions.
deprecated Package is unmaintained since 2017; not compatible with rollup >=1.x or @babel/runtime (Babel 7).
fix Migrate to native rollup external option or use @rollup/plugin-babel with externalHelpers.
gotcha Plugin does not respect existing external option; both are additive.
fix Manually list other external modules in the external option; plugin only handles babel-runtime.
gotcha Options helpers, polyfill, regenerator default to true; setting any to false excludes that subset of babel-runtime modules.
fix Explicitly set false only for the specific module types you want to bundle.
npm install rollup-plugin-babel-runtime-external
yarn add rollup-plugin-babel-runtime-external
pnpm add rollup-plugin-babel-runtime-external

Rollup configuration using the plugin to externalize babel-runtime modules with all options enabled.

// rollup.config.js
import babelRuntimeExternal from 'rollup-plugin-babel-runtime-external';

export default {
  input: 'src/index.js',
  output: {
    file: 'dist/bundle.js',
    format: 'cjs'
  },
  plugins: [
    babelRuntimeExternal({
      helpers: true,
      polyfill: true,
      regenerator: true
    })
  ]
};