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