webpack / webpack-dev-server

Serves a webpack app. Updates the browser on changes. Documentation https://webpack.js.org/configuration/dev-server/.
MIT License
7.8k stars 1.44k forks source link

No reload with `--hot` #40

Closed mattdesl closed 10 years ago

mattdesl commented 10 years ago

I couldn't see much info in the docs about this, so apologies if I'm missing a crucial step.

I've installed webpack and webpack-dev-server globally. I've got a new directory with an index.js:

console.log("Testing webpack...");

And a webpack.config.js:

module.exports = {
    context: __dirname,
    entry: './index.js'
}

And then I'm running it like so: wepack-dev-server --hot

After some hunting I realized the URL http://localhost:8080/webpack-dev-server/bundle is what I need for the reloading to work. Changing my JS and saving it will show the update in the terminal, but the browser will not reload and nothing new is printed to the console. Any ideas?

A related question: I'm also trying it regularly, without the --hot command. In this case, I can see the new changes to my JS logged in the console. But it looks like the page is never actually reloaded. This causes the console to never be cleared as I save the file. Is there a way to have it behave like a normal live-reload?

sokra commented 10 years ago

Read this guide.

module.exports = {
    context: __dirname,
    entry: ['webpack/hot/dev-server', './index.js']
}