-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
Compilation chunks can have duplicate ids #7381
Comments
This looks like a bug. |
Thanks for the rapid fix. I'm going to leave it running locally and see if it surfaces any other problems, but so far it looks promising. |
@sokra Is it intentional that with this change, ids from HashedModuleIdsPlugin are no longer recorded? I used to have several hundred lines in my webpack records.json looking something like this: {
"modules": {
"byIdentifier": {
"node_modules/lodash/_objectToString.js": "+66z",
"node_modules/react-dom/lib/getVendorPrefixedEventName.js": "+KdC",
"node_modules/babel-loader/lib/index.js??ref--1!assets/javascripts/lib/page_ready.js": "+PKl",
"node_modules/css-loader/index.js?{\"modules\":true,\"importLoaders\":1,\"localIdentName\":\"[name]__[local]___[hash:base64:5]\"}!node_modules/postcss-loader/lib/index.js?{}!assets/javascripts/components/uploader/Marker/Marker.css": "+TPF",
"node_modules/react-dom/lib/accumulateInto.js": "+VAZ",
"node_modules/lodash/throttle.js": "+X65",
"node_modules/raw-loader/index.js!node_modules/trumbowyg/dist/ui/icons.svg": "+XyB",
"node_modules/react-dom/lib/getEventCharCode.js": "+cCx",
"node_modules/react-dom/lib/CSSProperty.js": "+ktn",
"node_modules/babel-loader/lib/index.js??ref--1!assets/javascripts/stores/draggable_list_store.js": "+zBU",
"node_modules/babel-loader/lib/index.js??ref--1!assets/javascripts/components/admin/region_category_picker.jsx": "/5SY",
"node_modules/react-dom/lib/ReactNodeTypes.js": "/762",
"node_modules/babel-loader/lib/index.js??ref--1!assets/javascripts/components/embed_editor/preview_size_toolbar.jsx": "/EV3",
"node_modules/babel-loader/lib/index.js??ref--1!assets/javascripts/components/uploader/TimeInput/validate.js": "/SFD",
"node_modules/react-dom/lib/ReactDOMInvalidARIAHook.js": "/SFT",
"node_modules/react-dom/lib/setTextContent.js": "/bNP",
but since their id isn't a |
@jdelStrother It's a hash of the key, so no need to store them as they can be recreated. |
Bug report
(I think this is a bug. It's possible it's a feature I don't yet understand.)
What is the current behavior?
When using the split chunks plugin, the resulting compilation chunks sometimes have duplicate ids. For example, I added this debugging hook to my webpack config:
Resulting in this output:
Shouldn't that first chunk have an id of
lazy_store
?I've only seen the duplicate chunk ids where one of the chunks is my code, the other chunk is vendor/node_modules code (see the
cache group: vendors
bit).I've also only seen this happen when using recordsPath. If I delete my webpack records & re-build, all the chunk ids are unique.
If the current behavior is a bug, please provide the steps to reproduce.
Sorry, I'm really struggling to narrow this down. It seems to come and go at the whim of whatever heuristics drive SplitChunksPlugin. If someone can confirm this is a bug and it's not immediately obvious why it happens, I'll try harder.
What is the expected behavior?
Presumably all compilation chunks should have unique ids?
Other relevant information:
webpack version: 4.6.0
Node.js version: 8.11.1
Operating System: Docker with node:8.11-alpine
I'm using https://github.com/GProst/webpack-clean-obsolete-chunks, which expects chunks to have unique ids, and ends up accidentally deleting files when they don't. If it turns out that chunks are allowed to have duplicate ids, I'll submit a fix to that.
The text was updated successfully, but these errors were encountered: