-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvue.config.js
54 lines (52 loc) · 1.41 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
const path = require('path')
const fs = require('fs')
const { PORT, HOST } = process.env
module.exports = {
devServer: {
port: PORT,
host: HOST,
disableHostCheck: true
},
css: {
extract: false
},
pwa: {
workboxOptions: {
clientsClaim: true,
skipWaiting: true
}
},
pluginOptions: {
scaffold: {
// 用于引入svg图标到.vue文件
// https://github.com/nguyenvanduocit/vue-cli-plugin-style-resources-loader
svg: {
dir: resolve('src/assets/svg'), // 只有这个目录下的svg图片才会被转成组件
svgo: {
plugins: [
{ removeDoctype: true },
{ removeComments: true },
{ removeUselessStrokeAndFill: true }
]
}
}
},
// 用于把css预处理器的公共模块自动引入到每个文件中
// https://github.com/nguyenvanduocit/vue-cli-plugin-style-resources-loader
'style-resources-loader': {
preProcessor: 'scss',
patterns: [
path.resolve(__dirname, 'src/assets/styles/config.scss'),
path.resolve(__dirname, 'src/assets/styles/mixins.scss')
]
}
}
}
function resolve(dir) {
const data = fs.readFileSync('./package.json', 'utf8')
console.log(JSON.parse(data).version)
console.log(JSON.parse(data).version)
console.log(JSON.parse(data).version)
console.log(JSON.parse(data).version)
return path.join(__dirname, dir)
}