Preact-cli: HMR not working in 2.0.0

Created on 13 Oct 2017  ·  17Comments  ·  Source: preactjs/preact-cli


Do you want to request a feature or report a bug?
bug

What is the current behavior?
If I change something (component content for example) in my code, I have to do a manual page reload, seems like HMR has stopped working or something

If the current behavior is a bug, please provide the steps to reproduce.
Try to change something and see if it refreshes in the browser automatically

What is the expected behavior?
The changes are reflected immediately

Please mention other relevant information.

  • node version: 8.7.0
  • npm version: 5.5.1
  • Operating system MacOS 10.12.6 (16G29)

Most helpful comment

I was talking to Sean about the same and he said similar issue was reported in vue-cli as well for the same HMR.

The issue is in the html-webpack-plugin. Once it is fixed in the upstream, probably a minor release with version upgrade for CLI should be good.

Edit: (sorry for the noise, pressed the wrong button - reopened the issue)

All 17 comments

Hey,

I've spun up a fresh 2.0 app with the default template. HMR very much works.

Do you have a preact.config.js? Something there might be affecting the setup.

@lukeed I don't. I've used it out of the box, and suddenly - after I updated to v2.0.0, it's stopped working.

I'd wipe everything. Remove node_modules and any lock files, then reinstall.

@lukeed done that. Nothing.

Update: I was testing a 1.4.1 app, 🤦‍♂️

Webpack 3.x is indeed not allowing HMR. I've tested removal of ModuleConcatenationPlugin and it had no effect, which I expected, since we're only using it in production builds.

I just checked with v2.0.0 on a new machine. It works totally fine for me. All the changes what I make in the code are being reflected in the browser as usual.

@reznord are you sure you're working with 2.0.0? Check your package.json

Ah, bummer! My bad. So, HRM does fail in latest version. 😞

@developit Anything we can do about that?

removing ModuleConcatenationPlugin from webpack.base.config doesn't solve it. Changing the version to 1.4.1 it works.

@rchaubey yep - exactly what @lukeed tried

@rchaubey changing to 1.4.1 works because we are on webpack 2.x in v1.4.1 in which the HMR works without any problem.

Let's hope @developit will jump in ASAP

I was talking to Sean about the same and he said similar issue was reported in vue-cli as well for the same HMR.

The issue is in the html-webpack-plugin. Once it is fixed in the upstream, probably a minor release with version upgrade for CLI should be good.

Edit: (sorry for the noise, pressed the wrong button - reopened the issue)

417 has a temporary fix for this until it is fixed in webpack-dev-server, thanks @zouhir

Was this page helpful?
0 / 5 - 0 ratings

Related issues

higimo picture higimo  ·  3Comments

ethanwu10 picture ethanwu10  ·  3Comments

hardcoar picture hardcoar  ·  3Comments

haggen picture haggen  ·  3Comments

c0debreaker picture c0debreaker  ·  4Comments