Bird
0
0

Why might some unused Angular code still be included in the final bundle after tree shaking?

hard📝 Conceptual Q10 of 15
Angular - Performance Optimization
Why might some unused Angular code still be included in the final bundle after tree shaking?
ABecause Angular does not support tree shaking
BBecause the code has side effects or is referenced indirectly
CBecause the code is written in TypeScript
DBecause the app uses lazy loading
Step-by-Step Solution
Solution:
  1. Step 1: Understand tree shaking limitations

    Code with side effects or indirect references cannot be safely removed.
  2. Step 2: Eliminate incorrect options

    Angular supports tree shaking; TypeScript usage does not prevent it; lazy loading reduces bundle size but doesn't cause unused code inclusion.
  3. Final Answer:

    Because the code has side effects or is referenced indirectly -> Option B
  4. Quick Check:

    Side effects prevent safe removal by tree shaking [OK]
Quick Trick: Side effects keep unused code in bundles [OK]
Common Mistakes:
  • Thinking Angular lacks tree shaking support
  • Blaming TypeScript for bundle size
  • Confusing lazy loading with tree shaking

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Angular Quizzes