Add Polling for Bash on Windows (#302)

* Add Polling for Bash on Windows

Fixes #166

* Add Windows Bash Dependency
This commit is contained in:
Ian Mitchell 2016-11-28 06:04:59 -08:00 committed by Guillermo Rauch
parent 10b815b9c9
commit 7a66870af9
2 changed files with 12 additions and 1 deletions

View file

@ -46,6 +46,7 @@
"glamor": "2.18.2",
"glob-promise": "2.0.0",
"htmlescape": "1.1.1",
"is-windows-bash": "1.0.1",
"json-loader": "0.5.4",
"loader-utils": "0.2.16",
"minimist": "1.2.0",

View file

@ -1,6 +1,7 @@
import { join, relative, sep } from 'path'
import webpackDevMiddleware from 'webpack-dev-middleware'
import webpackHotMiddleware from 'webpack-hot-middleware'
import isWindowsBash from 'is-windows-bash'
import webpack from './build/webpack'
import read from './read'
@ -106,6 +107,14 @@ export default class HotReloader {
this.prevChunkHashes = chunkHashes
})
const windowsSettings = isWindowsBash() ? {
lazy: false,
watchOptions: {
aggregateTimeout: 300,
poll: true
}
} : {}
this.webpackDevMiddleware = webpackDevMiddleware(compiler, {
publicPath: '/_webpack/',
noInfo: true,
@ -124,7 +133,8 @@ export default class HotReloader {
timings: false,
version: false,
warnings: false
}
},
...windowsSettings
})
this.webpackHotMiddleware = webpackHotMiddleware(compiler, { log: false })