sideEffects
A package.json field that tells bundlers whether importing a file does anything besides defining exports.
In more detail
sideEffects: false lets a bundler drop any file whose exports are unused. Stylesheets do their work just by being imported, so they are listed as exceptions, for example sideEffects: ["*.css"].
Related terms
- tree shaking — Removing code that is exported but never imported from the final bundle, so less code is shipped.
- bundler — A build tool, such as webpack, Rollup or Vite, that follows imports and combines modules into files a browser can load efficiently.
- package.json — The JSON file at the root of every JavaScript package that records its name, version, dependencies, entry points and other settings.
Taught in
- Component Packaging: Dual ESM/CJS Builds & Package Exports — Design Systems & Component Engineering
- Platform Sprint: Evidence, Order, Proof — Kubernetes and Cloud Native Security Associate (KCSA) Exam Prep