See example/ for an example of usage.
First, install the npm module.
npm install --save-dev webpack-hippy-hot-middlewareNext, enable hot reloading in your webpack config:
-
Add the following plugins to the
pluginsarray:plugins: [ // OccurrenceOrderPlugin is needed for webpack 1.x only new webpack.HotModuleReplacementPlugin(), // Use NoErrorsPlugin for webpack 1.x new HippyHMRPlugin({ // HMR [hash].hot-update.json will fetch from this path hotManifestPublicPath: `http://localhost:${hippyListenPort}/dev/${projectNamePath}/`, }), new HippyReactRefreshWebpackPlugin({ overlay: false, test: /\.(js|jsx|ts|tsx)/, }), ];
-
Add
webpack-dev-middlewarethe usual wayvar webpack = require('webpack'); var webpackConfig = require('./webpack.config'); var compiler = webpack(webpackConfig); app.use( require('webpack-dev-middleware')(compiler, { noInfo: true, publicPath: webpackConfig.output.publicPath, }) );
-
Add
webpack-hippy-hot-middlewareattached to the same compiler instanceapp.use(require('webpack-hippy-hot-middleware')(compiler, httpServer));
And you're all set!