-
-
Notifications
You must be signed in to change notification settings - Fork 384
Runtime loader code ships multiple copies of the chunkMap.hash object #253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@jsnajdr sorry for delay, can you provide minimum example? |
Hi @evilebottnawi! Here is a repo with a little project that reproduces the issue: https://github.com/jsnajdr/webpack-chunkhash-duplicate After For large projects, the chunk map object can get quite big and becomes the largest part of the webpack runtime. |
@jsnajdr What you expected, |
I expected that there is only one instance of that object in the shipped webpack runtime. However different the logic for CSS and JS might be, both chunk hash objects are always identical. Generated by JSON.stringify(chunk.getChunkMaps().maps) |
@jsnajdr hm, PR welcome |
It was fixed a long time ago |
When using the mini-css-extract-plugin in a setup where filename templates for both JS and CSS use the
[chunkhash]
substitution:then the runtime code will be inflated by shipping two copies of the stringified
chunkMap.hash
object. One is injsonpScriptSrc
function, second one in the CSS-related code inrequireEnsure
.Each call to
mainTemplate.getAssetPath
creates its own copy. Also, the chunk map object is instantiated (and then GCed) on everyrequireEnsure
call.Is there a way to extract the map into a local variable? This is probably a webpack core issue rather than issue with this plugin, but I'm not sure.
The text was updated successfully, but these errors were encountered: