Dynamic locale import with webpackMode=lazy results in hundreds of chunks #3284
Unanswered
jbaldassari
asked this question in
General
Replies: 1 comment
-
Having them separated and loaded async isn't better ? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I just wanted to post this here in case it helps anyone else. I noticed that when dynamically importing locales with webpack and using the default options (no mode specified or
webpackMode: "lazy"
), webpack generates 500+ chunks which are loaded serially, significantly impacting app load time.Example:
To avoid this, pass the webpack hint
webpackMode: "lazy-once"
(see docs here), which still keeps the locales out of the main chunk but causes all of the locales to be loaded together as a single chunk instead of individual chunks. This results in much faster load time. Example:The before and after screenshots from
source-map-explorer
are below:Before:
After:
Beta Was this translation helpful? Give feedback.
All reactions