Created
August 3, 2018 14:57
-
-
Save peteristhegreat/f46ba5ff86014ac604e1865f032dc37e to your computer and use it in GitHub Desktop.
Webpack Hot Reload over NFS, WatchOptions, config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on https://github.com/MacKentoch/react-redux-bootstrap-webpack-ssr-starter.git project... | |
# In order to work with edits that happen on a remote NFS/network drive, you need to use polling. | |
# See where watchOptions are set below for it to happen. | |
const path = require('path'); | |
const webpack = require('webpack'); | |
const express = require('express'); | |
const devMiddleware = require('webpack-dev-middleware'); | |
const hotMiddleware = require('webpack-hot-middleware'); | |
const config = require('./webpack.hot.reload.config'); | |
const chalk = require('chalk'); | |
const app = express(); | |
const compiler = webpack(config); | |
app.use(devMiddleware(compiler, { | |
publicPath: config.output.publicPath, | |
historyApiFallback: true, | |
watchOptions: { | |
aggregateTimeout: 300, | |
poll: 50 | |
}, | |
})); | |
app.use(hotMiddleware(compiler, { | |
watchOptions: { | |
aggregateTimeout: 300, | |
poll: 50 | |
} | |
})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment