-
Notifications
You must be signed in to change notification settings - Fork 21
/
vue.config.js
79 lines (77 loc) · 1.89 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
const path = require('path')
const MergeIntoSingleFilePlugin = require('webpack-merge-and-include-globally');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
module.exports = {
outputDir: process.env.BUILD === 'library'
? path.resolve(__dirname, "./dist")
: path.resolve(__dirname, "./docs"),
css: {
loaderOptions: {
sass: {
data: `@import "@@/styles/shared.scss";`
}
}
},
configureWebpack: {
devServer: {
historyApiFallback: true
},
resolve: {
alias: {
vue$: 'vue/dist/vue.common',
'@@': path.resolve(__dirname, './src/system')
}
},
module: {
rules: [
{
resourceQuery: /blockType=docs/,
loader: process.env.BUILD === 'library'
? require.resolve('./src/loader/docs-trim-loader.js')
: require.resolve('./src/loader/docs-loader.js')
}
]
},
plugins: process.env.BUILD === 'library'
? [
new BundleAnalyzerPlugin({
analyzerMode: 'static',
openAnalyzer: false
}),
new MergeIntoSingleFilePlugin({
files: {
"shared.scss": [
path.resolve(__dirname, './src/system/tokens/generated/tokens.scss'),
path.resolve(__dirname, './src/system/styles/shared/**/*.scss')
]
}
})
]
: []
},
chainWebpack: config => {
config.module
.rule('eslint')
.use('eslint-loader')
.options({
fix: true
})
const svgRule = config.module.rule('svg')
svgRule.uses.clear()
svgRule
.use('vue-svg-loader')
.loader('vue-svg-loader')
.options({
svgo: {
plugins: [
{
removeViewBox: false
},
{
removeDimensions: true
}
]
}
})
}
}