-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.dev.js
57 lines (54 loc) · 1.51 KB
/
webpack.config.dev.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
const config = require('./webpack.config.js')
const webpack = require('webpack')
const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin')
const notifier = require('node-notifier')
// const ICON = path.join(__dirname, 'icon.png')
config.plugins.push(new webpack.NamedModulesPlugin())
config.plugins.push(new webpack.HotModuleReplacementPlugin())
config.plugins.push(new FriendlyErrorsWebpackPlugin({
compilationSuccessInfo: {
messages: ['You application is running here http://localhost:7001'],
// notes: ['我是附加说明']
},
clearConsole: true,
onErrors: (severity, errors) => {
if (severity !== 'error') {
return
}
const error = errors[0]
notifier.notify({
title: "Webpack error",
message: severity + ': ' + error.name,
subtitle: error.file || '',
// icon: ICON
})
}
}))
config.devServer = {
contentBase: './build',
historyApiFallback: true,
headers: {
"Access-Control-Allow-Origin": "*",
},
quiet: true, // 除了初始启动信息外,什么也不会写入控制台。这也意味着来自webpack的错误或警告是不可见的
port: 7001,
proxy: {
"/es": {
target: "http://localhost:7006",
},
"/header": {
target: "http://localhost:7003",
},
"/slider": {
target: "http://localhost:7004",
},
"/cloudServer": {
target: "http://localhost:7007",
},
"/utils": {
target: "http://localhost:7999",
},
}
}
config.mode = 'development'
module.exports = config