-
Notifications
You must be signed in to change notification settings - Fork 7
/
vue.config.js
98 lines (86 loc) · 2.18 KB
/
vue.config.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
const path = require('path')
const webpack = require('webpack')
const CompressionWebpackPlugin = require('compression-webpack-plugin')
const productionGzipExtensions = ['js', 'css']
function resolve (dir) {
return path.join(__dirname, dir)
}
const isProd = process.env.NODE_ENV === 'production'
let plugins = [
// Ignore all locale files of moment.js
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/)
]
if (isProd) {
plugins.push(
new CompressionWebpackPlugin({
filename: '[path].gz[query]',
algorithm: 'gzip',
test: new RegExp('\\.(' + productionGzipExtensions.join('|') + ')$'),
threshold: 10240,
minRatio: 0.8
})
)
}
// vue.config.js
const vueConfig = {
publicPath: '/',
configureWebpack: {
// webpack plugins
plugins,
// if prod, add externals
externals: {}
},
chainWebpack: (config) => {
config.resolve.alias
.set('@$', resolve('src'))
const svgRule = config.module.rule('svg')
svgRule.uses.clear()
svgRule
.oneOf('inline')
.resourceQuery(/inline/)
.use('vue-svg-icon-loader')
.loader('vue-svg-icon-loader')
.end()
.end()
.oneOf('external')
.use('file-loader')
.loader('file-loader')
.options({
name: 'assets/[name].[hash:8].[ext]'
})
},
css: {
loaderOptions: {
less: {
modifyVars: {
// less vars,customize ant design theme
'primaryColor': '#1d1e1f',
'navThemeColor': '#1d1e1f'
},
// DO NOT REMOVE THIS LINE
javascriptEnabled: true
}
}
},
devServer: {
// development server port 8000
port: 8010,
// If you want to turn on the proxy, please remove the mockjs /src/main.jsL11
// proxy: {
// //配置权限代理
// '/dbd-authority': {
// target: 'http://product.cdjiamigu.com:8003/dbd-authority',
// changeOrigin: true,
// pathRewrite: {
// '^/dbd-authority': ''
// }
// }
// },
},
// disable source map in production
productionSourceMap: false,
lintOnSave: true,
// babel-loader no-ignore node_modules/*
transpileDependencies: []
}
module.exports = vueConfig