You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refer: Original Issue
I am facing the exact issue in my production build. Since the original issue is closed and is a couple of years old, I would like to know what are the current solutions to the solution. As mentioned in the original discussion by @sokra, creating different modules for each export is difficult in my case given the shared module has inter-dependencies and thousands of exports.
Also i would like to know why wouldn't optimizations per runtime work for this issue. As per the doc:
Webpack 5 is now able (and does by default) to analyse and optimize modules per runtime (A runtime is often equal to an entrypoint). This allows to only exports in these entrypoints where they are really needed.
This should mean for each runtime( entry point ) if we add this optimization our next.config.js the unused exports will be re-calculated for that runtime. Hence for each page only the required code should be bundled. Please help me out understanding this optimization where i am going wrong.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Summary
refer: Original Issue
I am facing the exact issue in my production build. Since the original issue is closed and is a couple of years old, I would like to know what are the current solutions to the solution. As mentioned in the original discussion by @sokra, creating different modules for each export is difficult in my case given the shared module has inter-dependencies and thousands of exports.
Also i would like to know why wouldn't
optimizations per runtime
work for this issue. As per the doc:This should mean for each runtime( entry point ) if we add this optimization our next.config.js the unused exports will be re-calculated for that runtime. Hence for each page only the required code should be bundled. Please help me out understanding this optimization where i am going wrong.
Additional information
No response
Example
https://github.com/joyt/nextjs-tree-shake-fail
@alexander-akait please see this since it seems like an old problem.
Beta Was this translation helpful? Give feedback.
All reactions