System Design · Junior · Question 26 of 75
Why split the JS bundle into parts (code splitting)?
- ✓Correct answer: So the user loads only the code for the needed page or feature
- 2So the code runs in parallel in several browser threads
- 3To hide the source code from users
Explanation
One huge bundle slows down the first load. Splitting by routes and heavy components (import(), React.lazy) reduces the initial size. Frameworks like Next.js split by routes automatically.