-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
35 lines (28 loc) · 846 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
34
35
var webpack = require('webpack');
var webpackDevServer = require('webpack-dev-server');
var webpackConfig = require('./webpack.config.js');
var path = require('path');
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, {
// Webpack Dev Server DocumentRoot
contentBase: path.resolve(__dirname, 'public'),
// Webpack Dev Server takes this path to save the output file
publicPath: '/',
hot: true,
quite: false,
noInfo: false,
stats: {
colors: true
}
})
bundler.listen(3000, 'localhost', function() {
console.log("Bundling project, please wait...");
})