Potential Webpack 5 regression with `mode: development` and shared imports
See original GitHub issueBug report
What is the current behavior?
When using mode: development with the current Webpack 5 version (^5.0.0-beta.16 in package.json from npm install webpack@next), changes to a single file imported into two separate entrypoints do not get recognized.
If the current behavior is a bug, please provide the steps to reproduce.
I’ve reduced this to what I think is the absolute base case (without digging into specifics about mode: development vs mode: production) at https://github.com/ahwitz/webpack-issue-example . There may be some issues if you’re running on Windows due to filepaths, but the following steps work out of the box for me with a fresh clone on Mac OS 10.14.
To reproduce:
- Clone above repo, run
npm install - Run
gulp=> Console will print out “success: [hash]” - Open
src/entry-b.jsin a text editor and make a change =>compiletask will run and console will print out “success: [hash2]” - Make another change to
src/entry-b.js=>compiletask will run and console will print out “success: [hash2]”
What is the expected behavior?
The third printout above should be a third, different hash, as src/entry-b.js (and thus the compiled files) have changed again. Both dist/ files should also change to include the updates.
If mode: production is set, this correctly prints out a third, different hash and the files update. If you run this same code using Webpack 4.x, this correctly prints out a third, different hash and the files update.
Because of those two, I’m fairly certain this is a regression and have skipped reporting on StackOverflow first. I also haven’t tested this with using one of the Webpack native CLI tools because I was trying to reduce the base case from my organization’s production use. My apologies if this isn’t a regression or if this isn’t reproducible with webpack-dev-server.
Other relevant information: webpack version: 5.x Node.js version: 10.x Operating System: Mac OS 10.14.x Additional tools: Gulp 4.x
Edit a few hours later: I realized I accidentally misnamed the files, and if I switch the filenames to make it more realistic, things work again. More confused now and will leave things the way they are; if more debugging information is needed let me know.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)

Top Related StackOverflow Question
Thanks great find. I need to look into that in detail, not sure if this is the correct fix, but that you figured out that the snapshot deduplicate logic is the problem is a good find and makes it easier to fix that.
🎉