This repository was archived by the owner on Sep 5, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvue.config.js
77 lines (71 loc) · 1.59 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
const path = require('path')
require('toml-require').install()
const config = require('./hydre.toml')
const aliases = {
cmp: 'src/comps',
stl: 'src/styles',
v: 'src/views',
core: 'src/core',
rs: 'src/assets/resources',
svg: 'src/assets/svg',
root: './'
}
const registerAliases = (a, config) =>
Object.entries(a).forEach(([k, v]) => config.resolve.alias.set('@' + k, path.join(__dirname, v)))
const loadToml = config => {
const rule = config.module.rule('toml')
rule.uses.clear()
rule
.test(/\.toml$/)
.use('toml')
.loader('toml-loader')
.end()
}
const loadSvg = config => {
const rule = config.module.rule('svg')
rule.uses.clear()
rule
.test(/\.svg$/)
.use('svg')
.loader('vue-svg-loader')
.end()
}
const loadI18n = config => {
const rule = config.module.rule('i18n')
rule
.resourceQuery(/blockType=i18n/)
.type('javascript/auto')
.use('i18n')
.loader('@kazupon/vue-i18n-loader')
.end()
.use('yaml')
.loader('yaml-loader')
.end()
}
module.exports = {
productionSourceMap: false,
chainWebpack: config => {
registerAliases(aliases, config)
loadI18n(config)
loadToml(config)
loadSvg(config)
},
pwa: {
workboxPluginMode: 'InjectManifest',
workboxOptions: {
swSrc: './src/sw.js'
},
themeColor: config.themeColor,
appleMobileWebAppCapable: 'yes',
iconPaths: {
favicon32: 'img/icons/favicon-32x32.png',
favicon16: 'img/icons/favicon-16x16.png',
appleTouchIcon: 'img/icons/apple-touch-icon.png',
maskIcon: 'img/icons/safari-pinned-tab.svg',
msTileImage: '/img/icons/mstile-150x150.png'
}
},
devServer: {
disableHostCheck: true
}
}