-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdevServer.js
34 lines (29 loc) · 860 Bytes
/
devServer.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
34
var webpack = require('webpack');
var WebpackDevServer = require('webpack-dev-server');
var webpackConfig = require('./webpack.config.js');
var path = require('path');
var mainPath = path.resolve(__dirname, '..', 'src', 'index.js');
module.exports = function () {
var bundleStart = null;
var 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, {
publicPath: '/build',
inline: true,
hot: true,
quiet: false,
noInfo: true,
stats: {
colors: true
}
});
bundler.listen(3001, 'localhost', function () {
console.log('Bundling project, please wait...');
});
};