You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.0 KiB
42 lines
1.0 KiB
10 years ago
|
import React from 'react';
|
||
|
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: 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: 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');
|
||
|
});
|