forked from fengluo/qingcheng
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
34 lines (27 loc) · 855 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
var webpack = require('webpack');
var WebpackDevServer = require('webpack-dev-server');
var config = require('./webpack.config');
config.entry.app.unshift("webpack-dev-server/client?http://localhost:9090", "webpack/hot/dev-server");
config.plugins.push(new webpack.HotModuleReplacementPlugin());
config.devtool = 'eval';
var proxy = {
"/api/*": {target: "http://python-china.org", host: "python-china.org"},
};
if (process.env.NODE_ENV === 'local') {
proxy = {
"/api/*": "http://192.168.30.12:5000",
"/session*": "http://192.168.30.12:5000",
};
}
var app = new WebpackDevServer(webpack(config), {
publicPath: config.output.publicPath,
historyApiFallback: true,
proxy: proxy,
hot: true,
});
app.listen(9090, '0.0.0.0', function (err, result) {
console.log('http://localhost:9090');
if (err) {
console.log(err);
}
});