Registry /
devops / rollup-plugin-external-node-modules
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
muslnode 18–223 runs
build_error
glibcnode 18–223 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()],
});
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.
fixAdd 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.
fixEnsure 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.
fixUse import external from 'rollup-plugin-external-node-modules' (default import).
Audit
Dependencies
rollupoptionalpeer dependency required for plugin compatibility