forked from markerikson/react-redux-cesium-testing-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
devServer.js
49 lines (34 loc) · 1.23 KB
/
devServer.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
"use strict";
const path = require('path');
const express = require('express');
const webpack = require('webpack');
const webpackConfig = require('./webpack/webpack.dev.config.js');
const configValues = require("./config");
const PATHS = configValues.PATHS;
const ENVIRONMENT = configValues.ENVIRONMENT;
const CESIUM = configValues.CESIUM;
const app = express();
const compiler = webpack(webpackConfig);
const dllPath = path.join(PATHS.base, "distdll");
app.use(require('webpack-dev-middleware')(compiler, {
/**
* Webpack-dev-middleware config
* Reference: https://webpack.github.io/docs/webpack-dev-middleware.html
*/
publicPath : webpackConfig.output.publicPath,
// Use preset option for Webpack stats display, which gives
// nice colorized info without overly-large amounts of detail
stats: "normal",
}));
app.use(require('webpack-hot-middleware')(compiler));
app.use("/", express.static(PATHS.src));
app.use("/", express.static(dllPath));
app.use("/cesium", express.static(CESIUM.debugBuildPath));
app.listen(ENVIRONMENT.port, ENVIRONMENT.host, (err) => {
if(err)
{
console.log(err);
return;
}
console.log(`Listening at http://${ENVIRONMENT.host}:${ENVIRONMENT.port}`);
});