🌐Tree Shaking
Also known as Dead Code Elimination, Tree-Shaking
A build step that drops code you imported but never used.
Think of it like
Think of it like shaking an apple tree so the dead leaves fall off. Only the living parts stay.
Example
Emma imports one date function from a large library. Tree shaking keeps that one function and drops the other 200.
Why it matters
It keeps bundles small even when you use big libraries. Smaller bundles mean faster pages.
Definition
Common mistake
Key takeaways
- 1Unused code goes. Only what is called stays.
- 2Done by the bundler. At build time.
- 3Needs clean imports. Import only what you use.