-
Notifications
You must be signed in to change notification settings - Fork 2
/
vue.config.js
52 lines (49 loc) · 1.4 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
const SitemapWebpackPlugin = require('sitemap-webpack-plugin').default
const routerPaths = require('./src/router/sitemap').default.map((r) => r.path)
const DumpEnvVarsWebpackPlugin = require('./DumpEnvVarsWebpackPlugin.js')
process.env.VUE_APP_VERSION = require('./package.json').version
const dev = process.env.NODE_ENV === 'development'
module.exports = {
publicPath: '/',
pwa: {
themeColor: '#0D0C1E',
msTileColor: '#0D0C1E',
workboxPluginMode: 'InjectManifest',
workboxOptions: {
swSrc: './src/sw.js',
swDest: 'service-worker.js',
},
},
pluginOptions: {
webpackBundleAnalyzer: {
openAnalyzer: false,
analyzerMode: dev ? 'server' : 'disabled',
},
},
devServer: {
historyApiFallback: true,
},
chainWebpack: (config) => {
const svgRule = config.module.rule('svg')
svgRule.uses.clear()
svgRule
.use('vue-svg-loader')
.loader('vue-svg-loader')
.options({
svgo: {
plugins: [
{ collapseGroups: false },
{ moveGroupAttrsToElems: false },
{ moveElemsAttrsToGroup: false },
{ cleanupIDs: false },
],
},
})
config.plugin('sitemap').use(
new SitemapWebpackPlugin(process.env.BASE_URL, routerPaths, {
changeFreq: 'always',
}),
)
config.plugin('env').use(new DumpEnvVarsWebpackPlugin({ filename: 'env-vars.js' }))
},
}