Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add config option for watch polling. #946

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion template/build/dev-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ const compiler = webpack(webpackConfig)

const devMiddleware = require('webpack-dev-middleware')(compiler, {
publicPath: webpackConfig.output.publicPath,
quiet: true
quiet: true,
watchOptions: !config.dev.poll ? undefined : {
aggregateTimeout: 300,
poll: true,
}
})

const hotMiddleware = require('webpack-hot-middleware')(compiler, {
Expand Down
9 changes: 7 additions & 2 deletions template/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = {
// View the bundle analyzer report after build finishes:
// `npm run build --report`
// Set to `true` or `false` to always turn it on or off
bundleAnalyzerReport: process.env.npm_config_report
bundleAnalyzerReport: process.env.npm_config_report,
},
dev: {
env: require('./dev.env'),
Expand All @@ -34,6 +34,11 @@ module.exports = {
// (https://github.com/webpack/css-loader#sourcemaps)
// In our experience, they generally work as expected,
// just be aware of this issue when enabling this option.
cssSourceMap: false
cssSourceMap: false,
// In some environments (e.g. Folders in dropbox or similar services)
// Webpack's file watcher doesn't work correctly in its default mode,
// and consequently, HMR doesn't work as well.
// Switching to 'poll' mode solves this for a lot of scenarios.
poll: false
}
}