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-dependenciesVerified import paths — ran on the pinned version, not inferred.
Basic Rollup config using externalDependencies to automatically exclude external packages from bundle.
Migrate config to ES modules (use import syntax) and upgrade Node to 18.12.0 or later.
Add parentheses: plugins: [externalDependencies()]
Check package.json dependencies/peerDependencies and adjust with options if needed.
Use import statement or dynamic import(): import { externalDependencies } from 'rollup-config-external-dependencies' or const { externalDependencies } = await import(...).Use plugins: [externalDependencies()] with parentheses.
Ensure the package is installed and listed in dependencies or peerDependencies, or add it to external manually.