webpack-dev-server: Live Reloading and HMR do not work when setting target node-webkit

  • Operating System: Linux

  • Node Version: 10.15.3

  • NPM Version: 6.41

  • Yarn Version: 1.16.0

  • webpack Version: 4.34.0

  • webpack-dev-server Version: 3.7.1

  • This is a bug

  • This is a modification request

Code

Full test (for Live reloading, not HMR) is attached as a zip. Nothing else needed, this example installs NW as a dependency so it will run out of the box.

webpacknwtest.zip

Expected Behavior

Live Reloading and HMR should work when setting target “node-webkit”.

Actual Behavior

Neither live reloading nor HMR do work-

For Bugs; How can we reproduce the behavior?

Unpack the example. It contains everything to run the example in browser and nwjs. yarn install

For webbrowser example run yarn startweb

Change something in src/index.js and reload happens.

For nwjs example run yarn startnw

Change something in src/index.js and nothing happens. No reload. While my example does not show it, I know that it does not work with HMR either as I use it in a vue.js Application. The example was crafted just for the sake of this issue.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 26 (12 by maintainers)

Commits related to this issue

Most upvoted comments

Maybe a bit off topic, but I tried getting typescript+html-webpack-plugin+webpack-dev-server combo to work and have live reloading. I struggled for an hour only to find out I had to change target: "node" to target: "web". The only hint of this issue was that I didn’t see [WDS] Live Reloading enabled. in browser console.

I can’t comment wether this is a bug or an invalid case (how could you run node environment on browser?), but I think it is a straight forward thing to detect in the configuration and could write a warning to the browser console or terminal.

@Kristonitas sorry for delay, good idea, can you want implement this?

Sure, I can give a shot at this.

@evilebottnawi switch nw in package.json to 0.39.0-sdk