forked from cloudify-cosmo/cloudify-stage
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevServer.js
More file actions
67 lines (59 loc) · 2.06 KB
/
devServer.js
File metadata and controls
67 lines (59 loc) · 2.06 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
/**
* Created by kinneretzin on 29/08/2016.
*/
const webpack = require('webpack');
const WebpackDevServer = require('webpack-dev-server');
const webpackConfig = require('./webpack.config')({}, { mode: 'development' });
const Consts = require('./backend/consts');
const startWidgetBackendWatcher = require('./scripts/widgetBackendWatcher');
const host = 'localhost';
const devServerPort = 4000;
const stageBackendPort = 8088;
const contextPath = Consts.CONTEXT_PATH;
const proxyOptions = {
target: `http://${host}:${stageBackendPort}`,
secure: false
};
const options = {
publicPath: contextPath,
host,
inline: false,
historyApiFallback: {
index: `${contextPath}/static/index.html`
},
proxy: {
[`${contextPath}/auth`]: proxyOptions,
[`${contextPath}/ba`]: proxyOptions,
[`${contextPath}/bud`]: proxyOptions,
[`${contextPath}/clientConfig`]: proxyOptions,
[`${contextPath}/config`]: proxyOptions,
[`${contextPath}/external`]: proxyOptions,
[`${contextPath}/file`]: proxyOptions,
[`${contextPath}/filters`]: proxyOptions,
[`${contextPath}/github`]: proxyOptions,
[`${contextPath}/maps`]: proxyOptions,
[`${contextPath}/plugins`]: proxyOptions,
[`${contextPath}/source`]: proxyOptions,
[`${contextPath}/sp`]: proxyOptions,
[`${contextPath}/style`]: proxyOptions,
[`${contextPath}/templates`]: proxyOptions,
[`${contextPath}/ua`]: proxyOptions,
[`${contextPath}/userData`]: proxyOptions,
[`${contextPath}/wb`]: proxyOptions,
[`${contextPath}/widgets`]: proxyOptions
},
watchOptions: {
ignored: ['**/userData/**']
}
};
WebpackDevServer.addDevServerEntrypoints(webpackConfig[0], options);
const compiler = webpack(webpackConfig);
const server = new WebpackDevServer(compiler, options);
server.listen(devServerPort, host, err => {
if (err) {
console.log(err);
} else {
console.log(`Listening at http://${host}:${devServerPort}/`);
}
});
startWidgetBackendWatcher();