Skip to content
Performance·Advanced·Coding·1 min read

What does tree shaking remove that code splitting doesn't?

Short interview answer

Tree shaking removes exports that are provably never imported anywhere, shrinking a single bundle's contents at build time; code splitting instead reorganizes which code lives in which chunk and when that chunk loads, without necessarily removing anything.

Key takeaway

Explain the underlying mental model clearly, then support it with a concrete example and its trade-offs.

← Back to Code splitting and lazy loading

Related questions