Registry / devops / rollup-plugin-peer-deps-external

rollup-plugin-peer-deps-external

JSON →
library2.2.4jsnpmunverified

Automatically externalizes peerDependencies in Rollup bundles. Current stable version is 2.2.4 (last released October 2020), with a maintenance status. It eliminates manual enumeration of peer dependencies in the `external` config, supports module paths (e.g., `lodash/map`), and includes an optional `includeDependencies` flag. Compared to manually listing externals or using pattern-based approaches, this plugin provides a zero-config solution that reads from package.json. It is widely used in library bundling workflows and has minimal dependencies (only `rollup` as a peer dependency). Release cadence is low; no new features since 2.2.0.

npm install rollup-plugin-peer-deps-external
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-PEER
R
rollup-plugin-peer-deps-external
devopsjavascriptv2.2.4
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
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 18–223 runs
build_error
glibc
node 18–223 runs
build_error
Code
Verified usage

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

peerDepsExternal
✓ import peerDepsExternal from 'rollup-plugin-peer-deps-external'
✗ const peerDepsExternal = require('rollup-plugin-peer-deps-external')
Default export via ESM. CJS require works (package exports both) but ESM is preferred in modern bundles.

Basic Rollup configuration using the plugin to automatically externalize peer dependencies from package.json.

// rollup.config.js import peerDepsExternal from 'rollup-plugin-peer-deps-external'; export default { input: 'src/index.js', output: { dir: 'dist', format: 'esm' }, plugins: [ // Should be placed first to ensure peer deps are external before other plugins process them peerDepsExternal() ] };
Debug
Known issues
deprecatedThe `includeDependencies` option is deprecated and may be removed in future.
fix
Avoid using `includeDependencies`; manually externalize dependencies if needed.
affects: >=2.2.0 <3.0.0
breakingv2.0.0 changed behavior to also externalize module paths (e.g., 'lodash/map') in addition to top-level packages.
fix
If you relied on only top-level packages being externalized, update your imports or use a custom external function.
affects: >=2.0.0
gotchaPlugin must run early in plugin list to externalize peer deps before other plugins (e.g., commonjs) resolve them.
fix
Place `peerDepsExternal()` as the first plugin in the `plugins` array.
affects: >=1.0.0
gotchaDoes not handle custom `external` config; if you set both, the plugin may override or conflict.
fix
Either use the plugin alone or manually merge external patterns by reading peerDependencies yourself.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'rollup-plugin-peer-deps-external'
Package not installed or missing from dependencies.
fix
npm install --save-dev rollup-plugin-peer-deps-external
TypeError: peerDepsExternal is not a function
Importing incorrectly (e.g., named import instead of default import).
fix
Use `import peerDepsExternal from 'rollup-plugin-peer-deps-external'` (default import).
(!) Plugin peerDepsExternal: Options includeDependencies is deprecated
Using deprecated `includeDependencies` option.
fix
Remove `includeDependencies` from plugin options.
Upgrade
Version history
2.2.4latest on npm
Audit
Dependencies
rolluprequiredPeer dependency; plugin requires Rollup to function as a plugin.
Agent activity
4 hits · last 30 days
node
4
Resources
rollup-plugin-peer-deps-external — npm install rollup-plugin-peer-deps-external · libregistry