Registry / devops / rollup-config-external-dependencies

rollup-config-external-dependencies

JSON →
library3.0.1jsnpmunverified

Rollup configuration to automatically externalize all dependencies, peerDependencies, and optionalDependencies from the bundle. v3.0.1 is current, released June 2024. Node >=18.12.0 required, ESM-only since v3. Differentiators: zero-config, respects package.json fields, works with CommonJS and ESM outputs, and supports TypeScript projects out of the box. Releases are infrequent; v3 breaking change was dropping CJS and older Node versions.

npm install rollup-config-external-dependencies
INSTALL
IMPORT
SIG · ROLLUP-CONFIG-EXTE
R
rollup-config-external-dependencies
devopsjavascriptv3.0.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

externalDependencies
import { externalDependencies } from 'rollup-config-external-dependencies';
const externalDependencies = require('rollup-config-external-dependencies');
Package is ESM-only since v3.0.0; use dynamic import() if needed in CommonJS.
externalDependencies
export default { ..., plugins: [externalDependencies()] }
plugins: [externalDependencies]
externalDependencies is a function that returns a plugin instance; calling it is required.
externalDependencies
const { externalDependencies } = await import('rollup-config-external-dependencies');
For CommonJS or legacy Node, use dynamic import() with top-level await or async wrapper.

Basic Rollup config using externalDependencies to automatically exclude external packages from bundle.

// rollup.config.js import { externalDependencies } from 'rollup-config-external-dependencies'; export default { input: 'src/index.js', output: { dir: 'dist', format: 'esm', }, plugins: [ externalDependencies(), ], };
Debug
Known issues
breakingDropped CommonJS support and requires Node >=18.12.0.
fix
Migrate config to ES modules (use import syntax) and upgrade Node to 18.12.0 or later.
affects: >=3.0.0
gotchaPlugin must be called as a function: externalDependencies(), not used directly as externalDependencies.
fix
Add parentheses: plugins: [externalDependencies()]
affects: >=1.0.0
gotchaExternalization includes the package itself if it's listed as a dependency; ensure no unintended externals.
fix
Check package.json dependencies/peerDependencies and adjust with options if needed.
affects: >=1.0.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module
Using CommonJS require() on an ESM-only package since v3.0.0.
fix
Use import statement or dynamic import(): import { externalDependencies } from 'rollup-config-external-dependencies' or const { externalDependencies } = await import(...).
TypeError: externalDependencies is not a function
Using the imported value without calling it (not invoking parentheses).
fix
Use plugins: [externalDependencies()] with parentheses.
RollupError: Could not resolve 'some-package' (commonjs or esm dependency...)
An external dependency is not installed or not listed in package.json, but externalization is active.
fix
Ensure the package is installed and listed in dependencies or peerDependencies, or add it to external manually.
Upgrade
Version history
3.0.1latest on npm
Audit
Dependencies
rolluprequiredPeer dependency; plugin works only with Rollup
Agent activity
7 hits · last 30 days
node
6
Resources
rollup-config-external-dependencies — npm install rollup-config-external-dependencies · libregistry