forked from Vincent1993/V2EX-Vue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
27 lines (26 loc) · 760 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
'use strict'
var webpack = require('webpack');
var WebpackDevServer = require('webpack-dev-server');
var config = require('./webpack.config');
config.entry.unshift('webpack-dev-server/client?http://localhost:8890',"webpack/hot/dev-server");
config.plugins.push(new webpack.HotModuleReplacementPlugin());
config.plugins.push(new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}))
var proxy = [{
path: "/api/*",
target: "https://www.v2ex.com",
host: "v2ex.com"
}]
//启动服务
var app = new WebpackDevServer(webpack(config), {
publicPath: config.output.publicPath,
hot:true,
historyApiFallback: true,
proxy:proxy
});
app.listen(8890,function(){
console.log('server start!')
});