webpack: webpack 2 upgrade produces "webpackHotUpdate is not defined"

I’m submitting a bug report

webpack and webpack-dev-server version: webpack: 2.1.0-beta.20 webpack-dev-server: 1.14.1 and 2.1.0-beta.3

Please tell us about your environment: Linux Fedora 24

Expected/desired behavior: Reloading to work.

I’ve upgraded to webpack 2 in an angular project. After the upgrade, the exact same configuration works, except for the reloading. webpack-dev-server will always throw the following Uncaught errors when files have changed. There are no errors in the console though:

Unexpected token <`

And

ReferenceError: webpackHotUpdate is not defined

This wouldn’t happen with Webpack 1. It now happens with webpack-dev-server both 1 and 2, and independently from whether or not HMR is enabled

Steps to reproduce

I have created a repo with my config and a basic angular skeleton.

https://github.com/cortopy/debug-webpack-dev-server

  1. npm install
  2. npm start
  3. Go to http://localhost:3000/
  4. Just change the html file debug-webpack-dev-server/src/app/app.component.html with anything you want to trigger the reload.
  5. On my end, that is enough to get the error.

What is the expected behavior? Webpack-dev-server to reload with and without HMR

What is the motivation / use case for changing the behavior? Please note that even though this is an issue with webpack-dev-server, an issue was already submitted in their repo: https://github.com/webpack/webpack-dev-server/issues/601#issuecomment-246106990

I’m submitting this issue here as instructed by one maintainer of the repo.

Also, the issue doesn’t seem to lie with dev-server itself, as error only happens with webpack 2 and any version of dev-server.

Browser: [all ]

Language: [TypeScript 2.0.0]

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 22 (14 by maintainers)

Commits related to this issue

Most upvoted comments

@voxmatt Thanks! Removing multiStep: true from HotModuleReplacementPlugin fixed the behavior for me. I guess it’s that specific mode that’s broken when html-webpack-plugin is used.