If you ever come across this topic and find yourself stuck with «why my bundle is not splitting up for chunks, but I'm doing everything as said» after reading documentation, please: check that the component used inside classic construction
React.lazy(() => import('MyFancyApp'))
is not imported anywhere else in your application!
Yeah, that easy, but not that easy if your start debugging right now and searching for information online. The whole internet is flooded with identical articles and standard recipes.
In our team's case, it was index.tsx files with helper imports. Like this:
# index.tsx
export * from "./MyFancyApp.tsx"
Remove or replace these imports with lazy implementation and splitting starts working as it should.
Top comments (0)