forked from setube/vue-XiuXianGame
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.js
112 lines (109 loc) · 3.42 KB
/
vite.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
108
109
110
111
import path from 'path';
import vue from '@vitejs/plugin-vue';
import Icons from 'unplugin-icons/vite';
import { VitePWA } from 'vite-plugin-pwa';
import AutoImport from 'unplugin-auto-import/vite';
import Components from 'unplugin-vue-components/vite';
import IconsResolver from 'unplugin-icons/resolver';
import { defineConfig } from 'vite';
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers';
import vitePluginBundleObfuscator from 'vite-plugin-bundle-obfuscator';
export default defineConfig({
base: './',
build: {
minify: 'terser',
rollupOptions: {
output: {
manualChunks: (id) => {
if (id.includes('node_modules')) return 'vendor';
},
chunkFileNames: 'assets/js/[name]-[hash].js',
entryFileNames: 'assets/js/[name]-[hash].js',
assetFileNames: (assetInfo) => {
if (assetInfo.name && assetInfo.name.endsWith('.ico')) return '[name].[ext]';
return 'assets/[ext]/[name]-[hash].[ext]';
}
}
},
terserOptions: {
compress: {
drop_console: false,
drop_debugger: true
}
}
},
plugins: [
vue(),
Icons({
autoInstall: true
}),
VitePWA({
manifest: {
name: '我的文字修仙全靠刷',
icons: [
{
src: '/icons/icon-192x192.png',
sizes: '192x192',
type: 'image/png'
},
{
src: '/icons/icon-512x512.png',
sizes: '512x512',
type: 'image/png'
}
],
short_name: '文字修仙',
description: '文字游戏: 我的文字修仙全靠刷',
theme_color: '#4d4d4d'
},
devOptions: {
enabled: true
},
registerType: 'autoUpdate'
}),
AutoImport({
resolvers: [
IconsResolver({
prefix: 'Icon'
}),
ElementPlusResolver()
]
}),
Components({
resolvers: [
IconsResolver({
enabledCollections: ['ep']
}),
ElementPlusResolver()
]
}),
vitePluginBundleObfuscator({
log: false,
enable: true,
options: {
log: false,
compact: true,
stringArray: true,
renameGlobals: false,
selfDefending: false,
debugProtection: false,
rotateStringArray: true,
deadCodeInjection: false,
stringArrayEncoding: ['none'],
disableConsoleOutput: true,
stringArrayThreshold: 0.75,
controlFlowFlattening: false,
unicodeEscapeSequence: true,
identifierNamesGenerator: 'hexadecimal'
},
excludes: ['router.js'],
autoExcludeNodeModules: true
})
],
resolve: {
alias: {
'@': path.resolve(__dirname, 'src')
}
},
logLevel: 'error'
});