Registry / devops / rollup-plugin-external-node-modules

rollup-plugin-external-node-modules

JSON →
library1.0.1jsnpmunverified

Rollup plugin that automatically marks all node_modules packages as external, preventing them from being bundled. Version 1.0.1 is current, stable, and likely low-maintenance. It simplifies Rollup configuration by removing the need to manually list externals. Ships TypeScript types. Key differentiator: zero-config approach compared to manual externals or other plugins like @rollup/plugin-node-resolve combined with externals.

npm install rollup-plugin-external-node-modules
INSTALL
IMPORT
SIG · ROLLUP-PLUGIN-EXTE
R
rollup-plugin-external-node-modules
devopsjavascriptv1.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.

default
import external from 'rollup-plugin-external-node-modules'
const external = require('rollup-plugin-external-node-modules')
Plugin exports a default function via ESM; CommonJS require may not work if package is ESM-only (check package.json: type: module).
externalNodeModules
import externalNodeModules from 'rollup-plugin-external-node-modules'
The default export is the plugin itself; you can rename it during import. This is not a named export.
types
import type { RollupPluginExternalNodeModules } from 'rollup-plugin-external-node-modules'
import { RollupPluginExternalNodeModules } from 'rollup-plugin-external-node-modules'
The package ships TypeScript types; type-only imports should use 'import type'. Named export 'RollupPluginExternalNodeModules' does not exist as a value.

Basic Rollup configuration using the plugin to automatically externalize all node_modules packages.

import external from 'rollup-plugin-external-node-modules'; import { defineConfig } from 'rollup'; export default defineConfig({ input: 'src/index.js', output: { dir: 'dist', format: 'esm', }, plugins: [external()], });
Debug
Known issues
gotchaPlugin does not respect Rollup's 'external' option if both are used; run order matters.
fix
Do not manually add packages to Rollup's 'external' option when using this plugin, or ensure plugin is listed first.
affects: >=1.0
gotchaOnly marks packages under node_modules as external; does not handle deep imports like 'lodash/fp' correctly in all cases.
fix
Manually add any specific subpaths to Rollup's 'external' option if needed.
affects: >=1.0
gotchaPlugin does not work with PnP (Plug'n'Play) environments by default; may not detect dependencies correctly.
fix
Use with @yarnpkg/plugin-pnp and ensure node_modules is present or handle manually.
affects: >=1.0
Errors
Common errors & fixes
The following Node.js built-in modules were not found: fs, path
Plugin externalizes everything in node_modules but not Node.js built-ins if they are not listed as dependencies.
fix
Add Rollup's builtins plugin or manually externalize built-ins: external: ['fs', 'path', ...].
Error: Could not resolve 'some-package'
If 'some-package' is not in node_modules (e.g., a monorepo workspace), the plugin will not externalize it.
fix
Ensure the package is installed or add it to Rollup's 'external' option.
TypeError: external is not a function
Incorrect import; likely used named import instead of default import.
fix
Use import external from 'rollup-plugin-external-node-modules' (default import).
Upgrade
Version history
1.0.1latest on npm
Audit
Dependencies
rollupoptionalpeer dependency required for plugin compatibility
Agent activity
11 hits · last 30 days
node
8
Bingbot
1
Resources
rollup-plugin-external-node-modules — npm install rollup-plugin-external-node-modules · libregistry