forked from bailicangdu/react-pxq
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver_hot.js
More file actions
executable file
·35 lines (29 loc) · 796 Bytes
/
Copy pathserver_hot.js
File metadata and controls
executable file
·35 lines (29 loc) · 796 Bytes
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
var webpack = require('webpack');
var express = require('express');
var config = require('./webpack.config.hot');
var proxyMiddleware = require('http-proxy-middleware')
var app = express();
var compiler = webpack(config);
app.use(require('webpack-dev-middleware')(compiler, {
publicPath: config.output.publicPath,
hot: true,
historyApiFallback: true,
inline: true,
progress: true,
stats: {
colors: true,
}
}));
//代理服务器
app.use('/shopro', proxyMiddleware({
target: 'http://dev.fe.ptdev.cn',
changeOrigin: true,
}))
app.use(require('webpack-hot-middleware')(compiler));
//将其他路由,全部返回index.html
app.get('*', function(req, res) {
res.sendFile(__dirname + '/index.html')
});
app.listen(8088, function() {
console.log('正常打开8088端口')
});