-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathserve.js
More file actions
31 lines (26 loc) · 743 Bytes
/
serve.js
File metadata and controls
31 lines (26 loc) · 743 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
var WebpackDevServer = require("webpack-dev-server")
var config = require("./webpack.config.js")
var webpack = require("webpack")
var publicPath = '/__build__'
//重新配置webpack.config.js
config.entry.app.unshift()
config.entry.app.unshift('webpack-dev-server/client?http://localhost:8700/', 'webpack/hot/only-dev-server')
config.output.publicPath = publicPath
var server = new WebpackDevServer(webpack(config), {
contentBase: ['./app'],
publicPath: publicPath,
hot: true,
historyApiFallback: true,
stats: {
colors: true
},
noInfo: false,
quiet: false
});
server.listen(8700, 'localhost', function(error, result){
if(error){
console.error(error)
}else {
console.log('Server listening on http://127.0.0.1:8700.')
}
})