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

Webpack 2 and Hot module replacement #27

Closed
thangngoc89 opened this issue Sep 8, 2016 · 4 comments
Closed

Webpack 2 and Hot module replacement #27

thangngoc89 opened this issue Sep 8, 2016 · 4 comments
Assignees
Labels

Comments

@thangngoc89
Copy link

thangngoc89 commented Sep 8, 2016

We're migrating to webpack 2 at Phenomic but HMR isn't working for us. Did you test with webpack 2 and HMR ?

Our branch is here https://github.com/MoOx/phenomic/tree/webpack-2

Our dev-server is an express instance with webpack-dev-middleware and webpack-hot-middleware

Behaviours:

  • Route /**.hot-update.json not found
  • Client doesn't fetch the new hot-update hash correctly.
    • If I start the dev server, make a change to trigger HMR. Via /__webpack_hmr I can see that the new hash for hot-update is A. Client fetches /A.hot-update.json but it's a route not found as I said above.
    • Next, I make another update and get hash B. Client still fetches A.hot-update.json
    • Restart dev server, make a changes, now the client fetches hash B.
@mzgoddard
Copy link
Owner

@thangngoc89 I have tested with webpack 2. I'm not sure if I've tested with webpack 2's hmr. I'll take a look.

@MoOx
Copy link

MoOx commented Sep 8, 2016

Thank you!

@mzgoddard
Copy link
Owner

@thangngoc89 @MoOx I'll have a change up soon that'll fix this.

The problem is HardSource currently runs a pre-compile to detect module's harmony imports and exports changing (cause it means it needs to invalidate the dependency and rebuild it). That pre-compile is interfering with HMR leading it to think no change happened in the build. Cool thing from this I found that webpack 2 adds a new entry point (need-additional-pass) to make webpack optionally perform multiple passes. Rewriting the pre-compile into performing an additional pass instead will fix HMR and make HardSource less hacky!

@thangngoc89
Copy link
Author

@mzgoddard Thank you. You're awesome

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

No branches or pull requests

3 participants