webpack-dev-hot-middleware
v1.0.3
Published
Reload webpack configuration in your express application
Downloads
3
Readme
webpack-dev-hot-middleware
Reload webpack configuration in your express application
Example usage
const express = require("express")
const path = require("path")
const app = express();
const hmrWebpack = require("webpack-dev-hot-middleware")
// absolute webpack path file
const webpackFile = path.join(__dirname, "..", "webpack.config.js");
const { middleware, emitter } = hmrWebpack(webpackFile, config => ({
publicPath: config.output.publicPath
}));
// Will be fired when webpack config is malformed
emitter.on("error", (err) => {
console.log("Webpack error", err);
})
// Will be fired when webpack is successful reloaded
emitter.on("reload", () => {
console.log("Successful reloaded");
})
app.use(middleware);
app.listen(3000);