-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathserver.js
More file actions
29 lines (22 loc) · 707 Bytes
/
server.js
File metadata and controls
29 lines (22 loc) · 707 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* eslint-disable no-console */
const path = require('path');
const webpack = require('webpack');
const express = require('express');
const webpackDevMiddleware = require('webpack-dev-middleware');
const webpackHotMiddleware = require('webpack-hot-middleware');
const config = require(path.join(__dirname, process.argv[2]));
const app = express();
const compiler = webpack(config);
app.use(webpackDevMiddleware(compiler, {
noInfo: true,
stats: { colors: true },
publicPath: config.output.publicPath,
}));
app.use(webpackHotMiddleware(compiler));
app.listen(3000, '0.0.0.0', (err) => {
if (err) {
console.error(err);
return;
}
console.info('Listening at http://0.0.0.0:3000');
});