fire.app/stubs/server.js

17 lines
595 B
JavaScript
Raw Normal View History

2020-02-08 13:37:13 +03:00
const hotClient = require('webpack-hot-client');
const middleware = require('webpack-dev-middleware');
const webpack = require('webpack');
const config = require('../webpack.config');
const app = require('../stubs');
const compiler = webpack(config);
const { publicPath } = config.output;
const options = { }; // webpack-hot-client options
// we recommend calling the client _before_ adding the dev middleware
const client = hotClient(compiler, options);
const { server } = client;
server.on('listening', () => {
app.use(middleware(compiler, { publicPath, historyApiFallback: true }));
});