Registry / devops / rollup-plugin-auto-external

rollup-plugin-auto-external

JSON →
library2.0.0jsnpmunverified

A Rollup plugin that automatically externalizes dependencies and peerDependencies listed in package.json, keeping them out of the bundle for library development. Version 2.0.0 (latest) supports Rollup ≥0.45.2 and Node ≥6. Key differentiator: automatically parses dependencies, peerDependencies, and optionalDependencies from package.json, unlike manual external configuration or other plugins that require explicit lists. Simple to set up with zero configuration for most cases.

npm install rollup-plugin-auto-external
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-AUTO
R
rollup-plugin-auto-external
devopsjavascriptv2.0.0
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.

default
import autoExternal from 'rollup-plugin-auto-external'
const autoExternal = require('rollup-plugin-auto-external')
ESM default export. CommonJS require works but is not idiomatic for Rollup plugins; prefer ESM import.
autoExternal
import autoExternal from 'rollup-plugin-auto-external'
Named import is not available; the module only provides a default export. Always use default import.
autoExternal()
autoExternal()
new autoExternal()
The plugin is a function that returns a plugin object. Do not use 'new'.

Shows minimal Rollup config using autoExternal to exclude all package.json dependencies from the bundle.

import autoExternal from 'rollup-plugin-auto-external'; export default { input: 'src/index.js', output: { file: 'dist/bundle.js', format: 'cjs' }, plugins: [ autoExternal() ] };
Debug
Known issues
gotchaPlugins listed after autoExternal in the plugins array will still process external dependencies. Ensure autoExternal is placed before other plugins that transform code (e.g., babel) to avoid bundling dependencies.
fix
Place autoExternal as the first plugin in the plugins array.
affects: >=1.0.0
gotchaautoExternal only respects dependencies, peerDependencies, and optionalDependencies from the root package.json. It does not handle monorepo structures or workspaces. Dependencies from nested packages will not be automatically externalized.
fix
Manually externalize dependencies from workspace packages or use a monorepo-aware plugin.
affects: >=1.0.0
gotchaIf your package.json has no 'dependencies', 'peerDependencies', or 'optionalDependencies' fields, autoExternal will externalize nothing. This may lead to unintended bundling of dependencies that should be external.
fix
Ensure package.json contains the relevant dependency fields, or manually configure external.
affects: >=1.0.0
breakingVersion 2.0.0 dropped support for Rollup <0.45.2. Plugins may fail silently or with cryptic errors if used with older Rollup versions.
fix
Upgrade Rollup to >=0.45.2.
affects: >=2.0.0 <3.0.0
Errors
Common errors & fixes
Error: Unexpected key 'auto-external' found in plugins
Using plugin name string instead of function call.
fix
Use autoExternal() instead of 'auto-external' in plugins array.
TypeError: autoExternal is not a function
Importing the plugin incorrectly (e.g., named import instead of default).
fix
Use `import autoExternal from 'rollup-plugin-auto-external'`.
(!) Missing global variable name https://rollupjs.org/...
autoExternal externalizes a dependency but the output format (e.g., iife) requires a global variable name. The plugin does not provide globals mappings.
fix
Manually add a `globals` config for external dependencies or use output.format 'cjs'/'es'.
Upgrade
Version history
2.0.0latest on npm
Audit
Dependencies
rolluprequiredpeer dependency - plugin requires Rollup to function
Agent activity
8 hits · last 30 days
node
6
Resources
rollup-plugin-auto-external — npm install rollup-plugin-auto-external · libregistry