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

HMR stopped work after webpack upgrade from 3 to 4 #292

Closed
Yizhachok opened this issue Mar 24, 2018 · 7 comments
Closed

HMR stopped work after webpack upgrade from 3 to 4 #292

Yizhachok opened this issue Mar 24, 2018 · 7 comments

Comments

@Yizhachok
Copy link

HMR was broken for me after webpack upgrade from 3 to 4. Here small repo with reproduction of behaviour (I'v got [HMR] Nothing hot updated. message) https://github.com/Yizhachok/project-hmr

Here I have webpack configuration:
https://github.com/Yizhachok/project-hmr/tree/master/dev/client/webpack
Here I subscribe to HMR events:
https://github.com/Yizhachok/project-hmr/blob/master/client/environments/environment.hmr.ts#L36
console.log('Here'); never fired

@TheMechanic
Copy link

Same here. I'm not able to make it work :(

@bengrunfeld
Copy link

bengrunfeld commented May 9, 2018

Also getting same error. Using with Express and webpack-dev-middleware. Here is the error I am receiving in the browser:

Uncaught ReferenceError: require is not defined
    at Object.webpack-hot-middleware/client (client":1)
    at __webpack_require__ (bootstrap:673)
    at fn (bootstrap:53)
    at Object.0 (client.js:802)
    at __webpack_require__ (bootstrap:673)
    at ./src/css/style.css (bootstrap:728)
    at bootstrap:728

Looks like something similar is occurring with Webpack Node Externals:
liady/webpack-node-externals#17

Here is a link to my code:
https://github.com/bengrunfeld/app-engine-test-apps/blob/master/vanillajs-app/webpack.dev.config.js

Code is in webpack.dev.config.js

@farhanaslam5151
Copy link

whats the solution ??

@aztack
Copy link

aztack commented Oct 29, 2018

if I inject "webpack-hot-middleware/client" to each entry, I got
ReferenceError: installedChunks is not defined
but if I inject a js file (hot-client.js):

var hotClient = require('webpack-hot-middleware/client' + __resourceQuery)
hotClient.subscribe(function (event) {
  if (event.action === 'reload') {
    window.location.reload()
  }
})

There was not error and page reloaded, but HMR does not work.

@lampshaj
Copy link

lampshaj commented Jun 4, 2019

Was this ever solved?

@Venryx
Copy link

Venryx commented Nov 12, 2019

Just wanted to mention that I got an error related to the "__resourceQuery" being empty for webpack-dev-server, and eventually realized it was due to an update in webpack-dev-server that makes it automatically require the "webpack-dev-server" module when you call new WebpackDevServer().

I don't have time to go into it all, but here is the commit where I solved my issue: Venryx/mobx-devtools-advanced@d1fdb0d#diff-2c81437e455a833c25e31879ed05c465

A (brief) explanation of the change seems to be here: webpack/webpack-dev-server#1802 (comment)

@alexander-akait
Copy link
Member

Closing due to inactivity. Please test with latest version and feel free to reopen if still regressions. Thanks!

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

No branches or pull requests

8 participants