Rollup plugin to externalize dependencies that should not be bundled (e.g., dependencies, peerDependencies, Node.js built-ins). v3.2.0 adds Rollup v4 support. Maintained actively, with a focus on correct externalization and side-effect detection. Unlike manual external configuration, it integrates with @rollup/plugin-node-resolve and respects the package.json sideEffects field. Requires Node >=16.15 and Rollup 2.79.1 - 5.0. Ships TypeScript definitions.
npm install rollup-plugin-unbundleVerified import paths — ran on the pinned version, not inferred.
Show minimal rollup.config.js that uses the plugin to externalize dependencies and Node.js built-ins.
Update to v3.x and ensure no reliance on previous external patching behavior.
Review resolution behavior when upgrading from v1.x.
Upgrade to Rollup v4 if needed, or stay on v3.x.
Set sideEffects: false in your package.json to enable tree-shaking, or define sideEffects explicitly.
Order plugins: [nodeResolve(), unbundle()].
Use the external option in Rollup or configure monorepo packages manually.
npm install rollup-plugin-unbundle
Use import unbundle from 'rollup-plugin-unbundle' instead of require()
Remove global 'external' option if using unbundle plugin, or use custom external function.
Ensure your package.json has a sideEffects field; set to false if side-effect-free.
Check that the package is installed. If using @rollup/plugin-node-resolve, ensure it's placed before unbundle.