forked from react-bootstrap/react-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
40 lines (34 loc) · 981 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
35
36
37
38
39
40
import express from 'express';
import path from 'path';
import webpack from 'webpack';
import webpackMiddleware from 'webpack-dev-middleware';
import webpackConfigBuilder from '../webpack/webpack.config';
const development = process.env.NODE_ENV !== 'production';
let app = express();
if (development) {
let webpackConfig = webpackConfigBuilder({
development,
ie8: true
});
let publicPath = webpackConfig.output.publicPath;
webpackConfig.output.path = '/';
webpackConfig.output.publicPath = undefined;
console.log('webpackConfig');
console.log(webpackConfig);
app = app
.use(webpackMiddleware(webpack(webpackConfig), {
noInfo: false,
publicPath,
stats: {
colors: true
}
}))
.use(express.static(path.join(__dirname)));
} else {
app = app
.use(express.static(path.join(__dirname, '../ie8-built')));
}
app
.listen(4000, function () {
console.log('Server started at http://localhost:4000');
});