Currently, I have implemented webpack dev middleware in my project like this:
const compiledWebpack = webpack(config),
app = express(),
devMiddleware = webpackDevMiddleware(compiledWebpack, {
historyApiFallback: true,
publicPath: config.output.publicPath,
overlay: {
warnings: true,
errors: true
},
compress: true,
stats: { colors: true }
})
app.use(devMiddleware)
app.get('*', (req, res) => {
// Fetch index.html from the file system
const htmlBuffer = devMiddleware.fileSystem.readFileSync(`${config.output.path}/index.html`)
res.send(htmlBuffer.toString())
})
app.listen(PORT, function () {})
console.log('Server running on port ' + PORT)
Despite setting up webpack dev middleware, I'm not able to achieve live reloading or enable the overlay functionality. The reason for using this setup is due to the webpackhtmlplugin integration.
I think I might be overlooking a simple concept here :( Any suggestions?