rollup-plugin-internal
raw JSON → 1.0.4 verified Mon Apr 27 auth: no javascript
Rollup plugin (v1.0.4) that forces specified dependencies to be treated as internal, preventing Rollup from externalizing them. Useful when bundling libraries that re-export certain peer dependencies. Minimal configuration: just pass an array of module names. Works with Rollup >=0.45.2. Alternative to manual external() or other deduplication plugins.
Common errors
error Error: Cannot find module 'rollup-plugin-internal' ↓
cause Package not installed or missing from node_modules.
fix
Run 'npm install rollup-plugin-internal --save-dev' or 'yarn add -D rollup-plugin-internal'.
error TypeError: Object(...) is not a function ↓
cause Using named import { internal } instead of default import.
fix
Change to 'import internal from 'rollup-plugin-internal''.
error (!) Plugin internal: Specified modules are empty array (nothing to mark internal) ↓
cause Passed empty array or no arguments to the plugin.
fix
Provide an array with at least one module name, e.g., internal(['react']).
Warnings
gotcha The plugin must be listed last in the plugins array to ensure it correctly overrides externalization done by other plugins. ↓
fix Always place internal() as the final plugin in the rollup config plugins array.
gotcha Specified modules are marked as internal but not bundled automatically; other plugins (like node-resolve) must still resolve them. ↓
fix Ensure modules are resolvable by your bundle (e.g., use rollup-plugin-node-resolve).
deprecated The package has not been updated since 2018 and may not work with newer Rollup versions (>2.x) due to plugin API changes. ↓
fix Consider migrating to Rollup's built-in 'output.inlineDynamicImports' or custom resolveId hooks.
Install
npm install rollup-plugin-internal yarn add rollup-plugin-internal pnpm add rollup-plugin-internal Imports
- default import wrong
const internal = require('rollup-plugin-internal')correctimport internal from 'rollup-plugin-internal' - Named import (incorrect) wrong
import { internal } from 'rollup-plugin-internal'correctimport internal from 'rollup-plugin-internal'
Quickstart
// rollup.config.js
import internal from 'rollup-plugin-internal';
export default {
input: 'src/index.js',
output: { file: 'dist/bundle.js', format: 'es' },
plugins: [
internal(['lodash', 'moment'])
]
};