Description
I'm using webpack for tota11y and absolutely loving it, but I keep running into a problem with HMR and my config.
Following the instructions at http://webpack.github.io/docs/webpack-dev-server.html#hot-mode, I've added webpack/hot/dev-server
as an entry point. Running
webpack-dev-server --hot
Everything works as expected, but the problem comes when I build with webpack -p
. In doing so, I get the following error when running my bundle in a browser:
Uncaught Error: [HMR] Hot Module Replacement is disabled.
Grepping through my bundle I can see that error message, but why is this hot reloading code in my bundle?
I've since removed that bit from the entry field in my config, and hot reloading seems to work fine. So I remain a bit confused: do I not actually need webpack/hot/dev-server
in my config? Are the docs outdated?
I checked around for this error but couldn't find anything, so perhaps my problem runs deeper than that.
Activity
sokra commentedon Jun 15, 2015
The docs are wrong... 😢
Just use
webpack-dev-server --hot --inline
and don't anything special about webpack-dev-server or HMR to your webpack.config.js.sdras commentedon Jun 22, 2015
I'm getting this error as well.
sloria commentedon Jul 14, 2015
I am seeing this error as well. Passing
--hot --inline
to the command line fixes it.jdan commentedon Jul 19, 2015
Thank you @sokra, that worked. Sorry for not updating here!
I'm going to keep this open until a maintainer closes it, hopefully the docs will be updated soon. I would do it myself but I don't know enough about HMR.
chrisdrackett commentedon Aug 11, 2015
I'm getting the same, I had:
in my
webpage.config.js
and was getting errors when runningwebpack-dev-server
. However, runningwebpack-dev-server --hot --inline
makes everything work as expected.lubosz commentedon Sep 5, 2015
I have following in the config:
The browser shows following log:
Running
webpack-dev-server
with--hot --inline
does also not help.patgod85 commentedon Sep 9, 2015
I have the same issue as @lubosz
sokra commentedon Sep 9, 2015
Hot Module Replacement is disabled.
means theHotModuleReplacementPlugin
is not used.--hot
adds it. (because the CLI have access to your webpack configuration)hot: true
doesn't add it. (because the API doesn't have access to your webpack configuration)mailaneel commentedon Dec 8, 2015
You have to push
new webpack.HotModuleReplacementPlugin()
this into your plugins config, webpack-dev-server when used with nodejs api do not add it automaticallydavesnx commentedon Dec 16, 2015
I change from devServer stuff on the webpack config into --hot --inline in the CLI command and works perfectly. Also, using a express and handling the webpack config works too...
vinhtq commentedon Jan 21, 2016
@mailaneel Thanks! Your solution works!
ace-han commentedon Feb 18, 2016
@mailaneel Thanks!+1
Amberish commentedon Feb 23, 2016
Here is my webpack config. I have following folder structure:
I am compiling start.js in 'src' folder to 'script.js' in 'build/js' folder.
Running it with webpack is compiling exactly as I intended, however running webpack-dev server as:
is not doing as intended. However, in terminal it is showing compilation.
29 remaining items