Reputation: 2434
I know most people have the opposite problem but I actually want to disable the auto reload functionality.
This is how I run my server:
webpack-dev-server --open --progress
This is my dev server config:
devServer: {
contentBase: 'app',
port: 9005,
hot: false,
inline: false
}
Versions:
"webpack": "1.14.0",
"webpack-dev-middleware": "1.9.0",
"webpack-dev-server": "^1.16.2",
"webpack-hot-middleware": "2.13.2",
"webpack-md5-hash": "0.0.5"
With this setup webpack dev server opens the initial page as localhost:9005/webpack-dev-server/
with auto reload on (iframe
mode). When I set inline
to true
then it opens localhost:9005
and auto reload is still on (inline
mode => websockets).
Is there a way to disable auto reload entirely?
Upvotes: 50
Views: 57315
Reputation: 1
For webpacker users:
In config/webpack/development.js
environment.config.set('devServer.liveReload', false)
Upvotes: 0
Reputation: 1440
Here's an update for webpack-dev-server
3.x. Update your config/webpack/development.js
like so:
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
const environment = require('./environment');
environment.config.merge({
devServer: {
hot: false,
inline: false,
liveReload: false
}
});
module.exports = environment.toWebpackConfig();
Upvotes: 10
Reputation: 4889
Working solution for webpack 2.x and 3.x
config.devServer = {
hot: false,
inline: false,
}
Upvotes: 34
Reputation: 86
Didn't find an obvious solution either (webpack-dev-server version 1.16.5).
A partial solution seems to be:
webpack-dev-server --watch-poll 99999999999
This won't rebuild automatically. But it will still reload browser windows after the initial build.
Upvotes: 3
Reputation: 2253
The webpack client scripts are added by default to your bundle (since webpack 2), but you can disable those by adding --no-inline
to your CLI command.
Upvotes: 16
Reputation: 2434
As a workaround I excluded webpack client side scripts from the bundle. This seems to stop auto reload from happening. I did that by redirecting those script to a null loader.
{test: /webpack-dev-server\\client/, loader: "null-loader"},
Upvotes: 11