Build fluency in the vocabulary of statically determining and removing a bundle's unused exports.
0 / 5 completed
1 / 5
At standup, a dev mentions a bundler statically analyzing a module's import statements to determine which exports are actually used, then removing every unused export from the final bundle. What is this optimization called?
Tree shaking is exactly this: a bundler statically analyzes a module's import and export statements to determine which exports are actually used anywhere in the application, then removes every unused export from the final bundle, relying on the static, analyzable structure of ES module imports to make this determination safely. A hash collision is an unrelated hash-table concept about two keys sharing a bucket. This statically-determine-then-remove-unused-code approach is exactly why tree shaking can shrink a bundle that imports a large utility library down to only the handful of functions actually used.
2 / 5
During a design review, the team switches a utility-library dependency to use ES module imports specifically so the bundler's tree shaking can statically determine which functions are actually used and drop the rest. Which capability does this provide?
Tree shaking here provides a smaller final bundle containing only the code actually used, since statically analyzable ES module imports let the bundler safely determine and remove every unused export instead of including the entire library. Including the entire utility library regardless of import style ships code for functions the application never calls, inflating the bundle unnecessarily. This statically-determine-and-drop-unused behavior is exactly why tree shaking depends on ES module syntax rather than a dynamic module format that can't be analyzed the same way.
3 / 5
In a code review, a dev notices a utility-library dependency is imported using a dynamic, non-statically-analyzable module format, causing the bundler to include the entire library in the final bundle even though the application only calls two of its dozens of functions. What does this represent?
This is a missed tree-shaking opportunity, since switching to statically analyzable ES module imports would let the bundler determine and drop the dozens of unused functions instead of including the entire library. A cache eviction policy is an unrelated concept about discarded cache entries. This non-statically-analyzable-import pattern is exactly the kind of bundle bloat a reviewer flags once only a small fraction of a large library is actually used.
4 / 5
An incident report shows a page's bundle size ballooned after adding a small feature, because the utility library it depended on was imported using a dynamic, non-statically-analyzable module format, forcing the bundler to include the entire library instead of only the functions actually used. What practice would prevent this?
Switching to statically analyzable ES module imports lets tree shaking determine and drop every unused function instead of including the entire library. Continuing to use a dynamic, non-statically-analyzable import format for the utility library regardless of how much the bundle size balloons is exactly what caused the size increase described in this incident. This ES-module-import approach is the standard fix once a dependency is confirmed to block tree shaking with a non-analyzable import format.
5 / 5
During a PR review, a teammate asks why the team relies on tree shaking instead of simply importing only the specific functions needed from a library by hand, path by path, to avoid pulling in the rest. What is the reasoning?
Tree shaking automates determining and removing unused code across the entire dependency graph at build time, while manually importing specific functions path by path requires a developer to know and maintain every such import correctly across the whole codebase, which becomes error-prone and tedious as dependencies change. This is exactly why tree shaking is the standard, automated approach, while manual path-specific imports remain a fragile workaround for libraries that don't support it.
What does the "Tree Shaking Vocabulary" vocabulary exercise cover?
This exercise tests real IT vocabulary related to tree shaking vocabulary through 5 multiple-choice questions, each built from realistic workplace sentences rather than abstract definitions.
Is this vocabulary exercise free to use?
Yes. Every exercise on CoderSlingo, including this one, is completely free — no account, sign-up, or payment required.
How many questions does this exercise have?
This exercise has 5 questions. Each one shows a real-world sentence or scenario with multiple-choice options and an explanation once you answer.
What happens after I answer a question?
You'll see immediate feedback showing whether your answer was correct, along with a short explanation of why — then a button to move to the next question, and a full results screen at the end.
Can I retry the exercise if I get questions wrong?
Yes. Once you reach the results screen, click "Try again" to reset your answers and go through the exercise from the start as many times as you like.
Do I need to create an account to take this exercise?
No account is needed. Your answers are scored in your browser during the session — nothing is saved to a server, so you can jump straight in.
Is my progress saved if I leave the page?
No — progress within an exercise resets if you navigate away or reload. Each exercise is short enough to complete in a few minutes in one sitting.
Are these vocabulary exercises connected to other topics?
Yes — browse the full vocabulary exercises hub to find related modules covering adjacent IT topics and roles.
How is this different from reading a glossary or blog article?
Exercises like this one are active recall drills — you have to choose the correct term or phrasing yourself, which builds retention faster than passively reading a definition.
Where can I find more vocabulary exercises?
Browse the full Vocabulary exercises hub for hundreds of modules covering Agile, DevOps, security, databases, architecture, and more — organised by IT role and skill.