-
Notifications
You must be signed in to change notification settings - Fork 2
/
dev.js
38 lines (34 loc) · 1.03 KB
/
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
30
31
32
33
34
35
36
37
38
var WebpackDevServer = require("webpack-dev-server");
var webpack = require("webpack");
var config = require('./webpack.config.js');
var port = process.argv[2] || 3000;
[
"webpack-dev-server/client?http://localhost:"+port,
"webpack/hot/dev-server",
].forEach(function(one){
config.entry.main.unshift(one);
})
config.plugins.unshift(new webpack.HotModuleReplacementPlugin());
config.plugins.push(function() {
this.plugin('done', function(stats) {
setTimeout(function () {
console.log('====================================')
console.log('Client running on: http://localhost:'+port);
console.log('====================================')
},0);
})
})
config.output.path = "/";
config.debug = true;
var server = new WebpackDevServer(webpack(config), {
contentBase: "./dist/",
hot: true,
historyApiFallback: true,
filename: config.entry.main[0],
publicPath: "/",
stats: {
colors: true
}
});
server.listen(port, "localhost");
require('./server/app.js');