Skip to content

Commit

Permalink
Add Polling for Bash on Windows (#302)
Browse files Browse the repository at this point in the history
* Add Polling for Bash on Windows

Fixes #166

* Add Windows Bash Dependency
  • Loading branch information
IanMitchell authored and rauchg committed Nov 28, 2016
1 parent 10b815b commit 7a66870
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 11 additions & 1 deletion server/hot-reloader.js
Original file line number Diff line number Diff line change
@@ -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'

Expand Down Expand Up @@ -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,
Expand All @@ -124,7 +133,8 @@ export default class HotReloader {
timings: false,
version: false,
warnings: false
}
},
...windowsSettings
})

this.webpackHotMiddleware = webpackHotMiddleware(compiler, { log: false })
Expand Down

0 comments on commit 7a66870

Please sign in to comment.