I've made a minimal sample code to illustrate the problem, whenever I change any code, I got the following error on browser's console:
Uncaught RangeError: Maximum call stack size exceeded bundled.js:713
hotAddUpdateChunk bundled.js:5
webpackHotUpdateCallback bundled.js:6
webpackHotUpdateCallback bundled.js:6
webpackHotUpdateCallback bundled.js:6
...
Where bundled.js:6 is:
/******/ function hotAddUpdateChunk(chunkId, moreModules) {
Thanks for the test case. I'll take a look later in the evening.
This is one of those annoying cases where CLI version of webpack-dev-server does not behave like its Node API for some reason. I'll file a bug report in Webpack.
For now, creating server.js with this code and running it as npm run dev solves the problem:
var webpack = require('webpack');
var WebpackDevServer = require('webpack-dev-server');
var config = require('./webpack.config');
new WebpackDevServer(webpack(config), {
publicPath: config.output.publicPath,
hot: true
}).listen(8080, 'localhost', function (err, result) {
if (err) {
console.log(err);
}
console.log('Listening at localhost:8080');
});
Filed as https://github.com/webpack/webpack-dev-server/issues/106. Hopefully we can get it fixed once and for all, now that you provided the repro!
Nice! I didn't know the problem was in webpack-dev-server's CLI, thank you for the reply and the opened issue there...
Should we close this issue or let it open until https://github.com/webpack/webpack-dev-server/issues/106 gets solved?
Let's leave it open so it's visible.
As a commenter in webpack-dev-server/issues/87 says, you're probably tripping over this because you have both --hot on the CLI and also a new HotModuleReplacementPlugin() being added in your webpack.config.js.
@herebebeasties confirmed! Now I just check if --hot flag is present before add new HotModuleReplacementPlugin() and it just works
Can I ask you to add this to Troubleshooting doc page?
Sure you can! Later today, ok?
Thanks!
Found this issue because I, too, had --hot and in my plugins new HotModuleReplacementPlugin().
Found this issue because I, too, had --hot and in my plugins new HotModuleReplacementPlugin()
I removed webpack.HotModuleReplacementPlugin() from my plugins and left the --hot and it works as expected, now.
Most helpful comment
Found this issue because I, too, had
--hotand in my pluginsnew HotModuleReplacementPlugin().