-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathserver.js
33 lines (28 loc) · 835 Bytes
/
server.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
30
31
32
33
var webpack = require('webpack'),
WebpackDevServer = require('webpack-dev-server'),
webpackConfig = require('./webpack.config.js'),
opn = require('opn');
var bundleStart = null,
compiler = webpack(webpackConfig);
compiler.plugin('compile', function() {
console.log('Bundling...');
bundleStart = Date.now();
});
compiler.plugin('done', function() {
console.log('Bundled in ' + (Date.now() - bundleStart) + 'ms!');
});
var bundler = new WebpackDevServer(compiler, {
contentBase: './src',
publicPath: webpackConfig.output.publicPath,
historyApiFallback: true,
hot: true,
quiet: false,
noInfo: true,
stats: {
colors: true
}
});
bundler.listen(8080, 'localhost', function() {
console.log('Bundling project, please wait...');
opn('http://localhost:8080');
});