/
vue.config.js
94 lines (88 loc) · 2.97 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
const FileManagerPlugin = require('filemanager-webpack-plugin')
const Moment = require('moment')
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true,
publicPath: './',
productionSourceMap: false, // 不产出 .map 文件
outputDir: '../map',
devServer: {
proxy: {
'': {
// target: 'http://localhost:3000',
target: 'http://kylebing.cn:3000',
changeOrigin: true
},
}
},
configureWebpack: config => {
if (process.env.NODE_ENV === 'production') {
let packTimeString = new Moment().format('YYYY-MM-DD') // 打包时间
let plugins = []
plugins.push(
new FileManagerPlugin({
events: {
onEnd: {
mkdir: ['./archive'], // 新建 ./archive 目录
archive: [
// 打包 压缩包中不带 dist 外壳
{
source: '../map',
destination: `./archive/map-${packTimeString}.zip`,
format: 'zip',
options: {
gzipOptions: {
level: 1,
},
}
},
]
}
}
})
)
config.plugins = config.plugins.concat(plugins) // 将新建的 plugin 添加到原 config 中的 plugin 中
}
},
/**
* PWA 设置
*/
pwa: {
name: '路书', // 名字
themeColor: "#ffffff", // 背景颜色
appleMobileWebAppCapable: true, // 苹果 WebApp 支持
// manifest 设置
manifestOptions: {
name: '路书',
short_name: "路书",
theme_color: "#ffffff",
start_url: "./index.html",
display: "standalone",
background_color: "#ffffff",
icons: [
{
src: "logo.svg",
sizes: "512x512",
type: "image/svg+xml",
purpose: "any",
},
{
src: "appicon-apple.png",
sizes: "512x512",
type: "image/png",
purpose: "any",
},
],
},
// 图标
iconPaths: {
// 这里是项目外的路径,对应 public 目录
faviconSVG: 'logo.svg',
favicon32: 'favicon.png',
favicon16: 'favicon.png',
appleTouchIcon: 'appicon-apple.png',
maskIcon: null,
msTileImage: null
}
}
})