UNPKG

579 BJavaScriptView Raw
1import webpack from 'webpack';
2import express from 'express';
3import history from 'connect-history-api-fallback';
4import config from './webpack.config';
5
6const app = express();
7const compiler = webpack(config);
8
9app.use(history());
10
11app.use(
12 require('webpack-dev-middleware')(compiler, {
13 publicPath: config.output.publicPath,
14 stats: {
15 chunks: false,
16 colors: true,
17 },
18 }),
19);
20
21app.use(require('webpack-hot-middleware')(compiler));
22
23app.listen(3000, err => {
24 if (err) {
25 return console.error(err);
26 }
27
28 return console.log('Listening at http://localhost:3000/');
29});