webpack 2 upgrade produces "webpackHotUpdate is not defined"
See original GitHub issueI’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
Current behavior: After upgrading to Webpack 2.1, webpack-dev-server throws error after recompiling packages.
Expected/desired behavior: Reloading to work
- Steps to reproduce
I’ve upgraded webpack to v. 2.1 I use it with Angular 2 After that 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
- My config.
"use strict";
/**
* Environment
*/
process.env.NODE_ENV = "development";
/*
* Webpack packages
*/
const merge = require("webpack-merge"),
webpack = require("webpack");
/*
* Webpack Common Config
*/
const common = require("./webpack.common"),
PATHS = require("./webpack.paths");
/**
* Webpack Dev config
*/
const options = {
host: "localhost",
port: 3000
},
METADATA = {
baseUrl: "localhost"
};
const webpackDev = merge(common, {
// json: true,
metadata: METADATA,
debug: true,
devtool: "source-map",
output: {
path: PATHS.build,
filename: "[name].js",
sourceMapFilename: "[name].map",
chunkFilename: "[id].chunk.js"
},
devServer: {
port: options.port,
host: options.host,
historyApiFallback: true,
watchOptions: {
aggregateTimeout: 300,
poll: 1000
},
outputPath: PATHS.build + "/",
inline: true,
hot: false,
stats: {
hash: false,
version: false, // webpack version
timings: false, // show build compilation time (already shown)
assets: true,
chunks: false, // verbose output
modules: false, // similar to chunks
reasons: true,
children: false,
source: true,
errors: true,
errorDetails: true,
warnings: true,
publicPath: true
}
},
module: {
// Add file loaders which will be hashed in production
loaders: [{
test: /\.svg$/,
loader: "file?name=[path][name].[ext]",
include: PATHS.images
}, {
test: /url\.(sass|scss)$/,
loader: "file?name=[path][name].css!postcss!sass",
exclude: [PATHS.nodeModules]
}]
},
plugins: [
new webpack.HotModuleReplacementPlugin({
multiStep: true
})
],
sassLoader: {
indentedSyntax: true,
outputStyle: "expanded"
}
});
module.exports = webpackDev;
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
webpack 2 upgrade produces "webpackHotUpdate is not ...
I set up a minimal React example to debug. Note that I go through Babel there whereas the original issue was about TypeScript....
Read more >webpack-dev-server hot reload not working - Stack Overflow
It seems webpack-dev-server gets confused when it sees dist/bundle.js in the html file ... To fix your hot reload issue, set the content...
Read more >Hot Module Replacement - webpack
Hot Module Replacement (or HMR) is one of the most useful features offered by webpack. It allows all kinds of modules to be...
Read more >gaearon/react-hot-loader - Gitter
Hello - I'm playing around with react-hot-loader and webpack-dev-server and ... Uncaught TypeError: Cannot read property 'webpackHotUpdate' of undefined.
Read more >Webpack, Hot Module Replacement and the public path
The updated module (file hot/0.91f0...2.hot-update.js in my previous example) contains the whole chunk to replace: webpackHotUpdate(0 ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thank you @SpaceK33z , I’ve made the corrections you suggested and tested again. I’ve opened https://github.com/webpack/webpack/issues/2985 now.
@cortopy, thanks, I can reproduce your error with that. I have tried a couple of things, but unfortunately failed in finding a fix.
Some feedback:
--watchinnpm startis not necessary.src/index.ejsand by usinginline: trueinwebpack.dev.js). Remove the one insrc/index.ejs.import "./vendor/web-animations-next.min";The bug doesn’t seem to be in the dev-server. Most of the HMR logic is in webpack itself. I would suggest to make a ticket over there with the above repo (and the points above fixed). You’ll get better help over there.