Tree shaking
Bundler optimization: remove code that isn't used from the final bundle. Term from Rollup (Rich Harris, 2015). Requires static analysis → only works with ES modules.
Pre-ES-modules (CommonJS): impossible because require() is dynamic. ES import/export is statically analyzable. The bundler builds a dependency graph, marks unused code, drops it. sideEffects: false in package.json helps the bundler — say "this package has no side effects, drop freely". lodash-es vs lodash is the classic difference. Modern: Vite/Rollup/esbuild/Bun all tree shake; Webpack too (with mode: 'production').