question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Potential Webpack 5 regression with `mode: development` and shared imports

See original GitHub issue

Bug 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.js in a text editor and make a change => compile task will run and console will print out “success: [hash2]”
  • Make another change to src/entry-b.js => compile task 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:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
sokracommented, May 29, 2020

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.

0reactions
sokracommented, May 31, 2020

🎉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resolve | webpack
Configure how modules are resolved. For example, when calling import 'lodash' in ES2015, the resolve options can change where webpack goes to look...
Read more >
The 'mode' option has not been set, webpack will fallback to ...
But that shouldn't effect as webpack.client.production.js is empty !? – iCantFindaGoodUsername. Apr 12, 2021 at 5:32.
Read more >
Chapter 21 Discover Webpack and NPM - JavaScript for R
Therefore, webpack comes with a “development” mode that allows including the “source map,” which maps the compiled code to the source files. This...
Read more >
Simplify your monorepo with npm 7 workspaces
In the article I made a Create React App 4's app (based on webpack 4) to import a custom built module (using webpack...
Read more >
Faster SASS builds with Webpack // Localytics Engineering Blog
If hot reload is part of your CSS development workflow, compilation performance is critical. That 5-second compile time in your large ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found