webpack-dev-server icon indicating copy to clipboard operation
webpack-dev-server copied to clipboard

Browser not refreshing

Open aoshi321 opened this issue 11 years ago • 14 comments

Hi

The browser does not refresh automatically even though the file has updated. I have to manually refresh the browser.

This is the console output from the browser

[HMR] Waiting for update signal from WDS... webpack-dev-server.js:1 [WDS] Hot Module Replacement enabled. 2webpack-dev-server.js:1 [WDS] App updated. Recompiling... webpack-dev-server.js:1 [WDS] App hot update... dev-server.js:52 [HMR] Checking for updates on the server... log-apply-result.js:20 [HMR] Updated modules: log-apply-result.js:22 [HMR] - 3 log-apply-result.js:22 [HMR] - 0 dev-server.js:38 [HMR] App is up to date.

This is my config

var path = require('path'); module.exports = { entry: [ 'webpack/hot/dev-server', path.resolve(__dirname, 'app/test/main.js'), ], output: { path: path.resolve(__dirname, 'public'), filename: 'bundle.js', } };

Im calling it via this command from the package.json

"start": "webpack-dev-server --config webpack.development.js --devtool eval --progress --colors --hot --content-base public"

thanks

aoshi321 avatar Jun 28 '15 17:06 aoshi321

+1 same here

mistadikay avatar Jun 29 '15 07:06 mistadikay

It seems like almost everyone is plagued with this. I've spent 2 hours trying to get this working, and haven't managed to find one full single working example, only snippets, and when you pull them together, it's not watching and packaging the files.

hendrikswan avatar Jun 30 '15 21:06 hendrikswan

This was driving me insane, I have got it working by removing --hot and including plugins: [ new webpack.HotModuleReplacementPlugin() ]

in the webpack.config file.

daniel-erickson avatar Jul 01 '15 01:07 daniel-erickson

+1 same here, @daniel-erickson the fix works for me too, thanks!

jugend avatar Jul 02 '15 06:07 jugend

Updating WP to 1.10.1 fixed my issues.

jonmanzo avatar Jul 02 '15 19:07 jonmanzo

Yeah, can confirm that 1.10.1 fixed it. Thanks!

daniel-erickson avatar Jul 02 '15 22:07 daniel-erickson

I am seeing this issue with 1.11.0 and dev-server 1.10.1. Had to replace hot: true with:

plugins: [
new webpack.HotModuleReplacementPlugin()
]

to get it working

smaye81 avatar Aug 18 '15 20:08 smaye81

this is sooo bad documented

officechuber avatar Jan 24 '16 22:01 officechuber

@smaye81 Fixed in same way!

blade254353074 avatar Mar 02 '16 09:03 blade254353074

Thank you

liminalisht avatar Aug 14 '16 18:08 liminalisht

@smaye81 In my case , doing your solution reload the full page, not HMR.

diegolaciar avatar Dec 22 '16 17:12 diegolaciar

@smaye81 Thank you, same as webpack-dev-server@^1.16.2

dfang avatar Jan 07 '17 04:01 dfang

I had the same problem. I know it's a old topic but I have my webpack on port 9000 and application on port 3000 so in devServer I added:

headers: {
			'Access-Control-Allow-Origin': '*'
		}

Hope it helps.

ghost avatar Jul 05 '17 12:07 ghost

can confirm @daniel-erickson and @smaye81 's solution works in webpack 3.4.1 and webpack-dev-server 2.6.1 (reloading not working issue)

I am seeing this issue with 1.11.0 and dev-server 1.10.1. Had to replace hot: true with: plugins: [ new webpack.HotModuleReplacementPlugin() ] to get it working

Kitanga avatar Aug 06 '17 02:08 Kitanga