Skip to content
JavaScript·Intermediate·Conceptual·1 min read

What is tree shaking?

Short interview answer

It is build-time removal of exports proven unused, enabled by the static shape of ES module imports and exports. Side effects, dynamic access patterns, CommonJS interop, and inaccurate package metadata can limit safe elimination.

Key takeaway

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

← Back to JavaScript modules

Related questions