-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
107 lines (102 loc) · 2.95 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/**
* @describe vue-cli 配置文件
*/
const path = require("path");
const webpack = require("webpack");
let plugins = [
new webpack.DefinePlugin({
"process.env.FLUENTFFMPEG_COV": false
})
];
module.exports = {
lintOnSave: true, // 取消 eslint 验证
configureWebpack: {
node: {
__dirname: process.env.NODE_ENV !== "production",
__filename: process.env.NODE_ENV !== "production"
},
plugins
},
chainWebpack: config => {
config.module
.rule("varialbes")
.test(/\.node$/)
.use("node-loader")
.loader("node-loader")
.end();
const svgRule = config.module.rule('svg')
const prunedSvgIconPath = path.resolve(__dirname, './src/assets/svg/icons/pruned')
const unitedSvgIconPath = path.resolve(__dirname, './src/assets/svg/icons/united')
// 先清除掉默认的 svg rule
svgRule.uses.clear()
config.module.rule('pruned-svg')
.test(/\.svg$/)
.include.add(prunedSvgIconPath).end()
.use('svg-sprite-loader')
.loader('svg-sprite-loader')
.options({
symbolId: 'icon-[name]'
})
.end()
.use('svgo-loader')
.loader('svgo-loader')
.options({
plugins: [{ removeTitle: true }, { removeAttrs: { attrs: ['fill', 'stroke'] } }]
})
.end()
config.module.rule('united-svg')
.test(/\.svg$/)
.include.add(unitedSvgIconPath).end()
.use('svg-sprite-loader')
.loader('svg-sprite-loader')
.options({
symbolId: 'icon-[name]'
})
// 这里需要注意,因为上面我们清除了针对 svg 的 loader,然后指定了某个目录下的 svg 使用 svg-sprite-loader
// 这里会有个问题就是,其他目录的 svg 没有被 loader 处理,所以我们需要针对其他目录的 svg 采用 file-loader(默认)
const svgIconPath = path.resolve(__dirname, './src/assets/svg/icons')
const fileRule = config.module.rule('file')
fileRule.uses.clear()
fileRule
.test(/\.svg$/)
.exclude.add(svgIconPath).end()
.use('file-loader')
.loader('file-loader')
},
pluginOptions: {
electronBuilder: {
builderOptions: {
productName: "vap-player",
appId: "com.vap.vap-player",
"publish": [
{
"provider": "generic",
"url": ""
}
],
mac: {
icon: "public/icon.png",
target: ["dmg", "zip"],
type: "distribution",
},
win: {
icon: "public/icon.png",
"artifactName": "vap-player_${version}.${ext}",
target: [
{
target: "nsis",
arch: ["ia32"]
}
]
},
"nsis": {
"perMachine": true,
"oneClick": false,
"createDesktopShortcut": "always",
"allowToChangeInstallationDirectory": true,
"guid": "vap-player"
}
}
}
}
};