-
Notifications
You must be signed in to change notification settings - Fork 536
/
Copy pathdev.js
29 lines (22 loc) · 806 Bytes
/
dev.js
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
var express = require('express'),
webpack = require('webpack'),
// favicon = require('express-favicon'),
config = require('./webpack.dev.conf'),
app = express();
var compiler = webpack(config);
// for highly stable resources
app.use('/static', express.static(config.commonPath.staticDir));
// app.use(favicon(path.join(__dirname, '../favicon.ico')));
// handle fallback for HTML5 history API
app.use(require('connect-history-api-fallback')());
// serve webpack bundle output
app.use(require('webpack-dev-middleware')(compiler, {
noInfo: true,
publicPath: config.output.publicPath
}));
// enable hot-reload and state-preserving
// compilation error display
app.use(require('webpack-hot-middleware')(compiler));
app.listen(9000, '127.0.0.1', function(err) {
err && console.log(err);
});