-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
45 lines (40 loc) · 1.36 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
const path = require('path')
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
function resolve(dir) {
return path.join(__dirname, dir)
}
function addStyleResource(rule) {
rule.use('style-resource')
.loader('style-resources-loader')
.options({
patterns: [path.resolve(__dirname, './src/style/global/**/*.scss'),],
})
}
// 配置详见https://cli.vuejs.org/zh/config/
module.exports = {
lintOnSave: true,
devServer: {
overlay: {
warnings: true,
errors: true,
},
},
chainWebpack: config => {
config.resolve.alias
.set('@views', resolve('src/views'))
.set('@components', resolve('src/components'))
.set('@router', resolve('src/router'))
.set('@vuex', resolve('src/vuex'))
.set('@util', resolve('src/util'))
.set('@config', resolve('src/config'))
.set('@data', resolve('src/data'))
const types = ['vue-modules', 'vue', 'normal-modules', 'normal']
types.forEach(type => addStyleResource(config.module.rule('scss').oneOf(type)))
if (process.env.NODE_ENV === "production") {
config.plugin("webpack-report")
.use(BundleAnalyzerPlugin, [{
analyzerMode: 'server',
}]);
}
}
}