-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.server.js
54 lines (46 loc) · 1.26 KB
/
webpack.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
const webpack = require('webpack');
const WebpackDevServer = require('webpack-dev-server');
const config = require('./webpack.make')({
DEV: true
});
const appConfig = require('./server/config/environment');
const devServerEntry = [`webpack-dev-server/client?http://localhost:${appConfig.clientPort}/`, 'webpack/hot/dev-server'];
config.entry.app = devServerEntry.concat(config.entry.app);
const compiler = webpack(config);
export const server = new WebpackDevServer(compiler, {
contentBase: './client/',
hot: true,
historyApiFallback: true,
stats: {
modules: false,
cached: false,
colors: true,
chunk: false
},
quiet: false,
noInfo: false,
proxy: {
'/api': {
target: 'http://localhost:9000',
secure: false,
},
'/auth': {
target: 'http://localhost:9000',
secure: false,
},
'/primus': {
target: 'http://localhost:9000',
secure: false, // was false before https
ws: true,
},
},
});
/**
* Starts the dev server
* @returns {Promise}
*/
export function start() {
return new Promise(resolve => {
server.listen(appConfig.clientPort, 'localhost', resolve);
});
}