A decision guide for publishing a library with Rollup: why dual es + cjs output is the practical default, how external and sideEffects settings make or break tree-shaking, and how to validate the result.
Your bundle ships 70 KB of Lodash but you use five functions. Diagnose which import pattern is defeating tree-shaking, fix it, and verify with the bundle analyzer.
Rollup's tree-shaking works because ES modules are statically analyzable. Here's how it prunes unused code, a verifiable example, and the side-effect and CommonJS pitfalls that defeat it.
Rollup’s sideEffects flag lets you prune unused code, but it must be used carefully. Learn how to set the flag, test bundle size gains, and avoid breaking your app.
Rollup's ES-module-native design enables aggressive tree-shaking and automatic code-splitting. A reproducible example shows both mechanisms, plus the sideEffects and CommonJS pitfalls.
Learn how Rollup analyzes ES module graphs to drop unused exports, see a minimal configuration example, and understand the limits and common pitfalls that affect tree-shaking effectiveness.
Rollup's tree shaking uses ES Module static structure to drop unused exports. Learn how the treeshake config tunes aggressiveness, why sideEffects flags matter, and how to verify the output in CI.