Skip to content
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

First HMR update includes file that did not change #10174

Closed
yyx990803 opened this issue Dec 24, 2019 · 1 comment · Fixed by #10186
Closed

First HMR update includes file that did not change #10174

yyx990803 opened this issue Dec 24, 2019 · 1 comment · Fixed by #10186

Comments

@yyx990803
Copy link
Contributor

yyx990803 commented Dec 24, 2019

Bug report

What is the current behavior?

First HMR update after dev server start includes files that did not change, when the following conditions are met:

  • File A is imported in the entry file;
  • File A contains a wildcard export from file B;
  • File B in turn contains a wildcard export from file C, and also has additional named exports of its own.

If the current behavior is a bug, please provide the steps to reproduce.

Repro link

With the following dependency graph:

// deps/a.js
export * from './b'

// deps/b.js
export * from './c'
export function b() {} // <-- this extra export is needed to reproduce

// deps/c.js
export function c() {}

And in index.js:

import { c } from './deps/a'

// other parts of the codebase, unrelated to deps
import { hot } from './hot'
hot()
module.hot.accept('./hot', () => {
  hot()
})

After starting WDS and edit ./hot.js, the first HMR update somehow includes ./deps/a (although it never changed), and causes the page to do a full reload. However, this only happens for the first update. After the first HMR-caused page reload, HRM starts to function properly.

Directly importing from ./dps/b or ./dpes/c both work as expected. Removing the named export in ./deps/b also works as expected.

What is the expected behavior?

First HMR update should not include deps/a.js (which is not hot-accepted, thus causing the entire page to reload)

Other relevant information:
webpack version: v4.41.4 & v5.0.0-beta.10
Node.js version: v12.13.1
Operating System: macOS 10.14.6
Additional tools: N/A

@sokra
Copy link
Member

sokra commented Dec 27, 2019

fixed in 4.41.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants