-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
96 lines (88 loc) · 2.23 KB
/
vite.config.ts
File metadata and controls
96 lines (88 loc) · 2.23 KB
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
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
import { resolve } from 'path'
import { VitePWA } from 'vite-plugin-pwa'
// https://cdn.jsdelivr.net/gh/dylanNew/live2d/webgl/Live2D/lib/live2d.min.js
// https://vitejs.dev/config/
export default defineConfig({
// build: {
// rollupOptions: {
// external: ['APlayer','APlayer/dist/APlayer.min.css']
// }
// },
build: {
rollupOptions: {
input: {
main: resolve(__dirname, 'index.html'),
rank: resolve(__dirname, 'page/rank/index.html'),
bili: resolve(__dirname, 'page/bili/index.html'),
},
// output: {
// manualChunks: {
// // 将大型库单独打包
// pdf: ['pdfjs-dist', 'vue-pdf-embed'],
// }
// }
},
},
plugins: [
vue(),
VitePWA({
registerType: 'prompt',
injectRegister: false,
pwaAssets: {
disabled: false,
config: true,
},
manifest: {
name: 'Less ls More.',
short_name: 'lesslsmore',
description: 'Less ls More.',
theme_color: '#ffffff',
},
workbox: {
// 将限制提高到 5MB(5 * 1024 * 1024 bytes)
maximumFileSizeToCacheInBytes: 5 * 1024 * 1024,
globPatterns: ['**/*.{js,css,html,svg,png,ico}'],
cleanupOutdatedCaches: true,
clientsClaim: true,
},
devOptions: {
enabled: true,
navigateFallback: 'index.html',
suppressWarnings: true,
type: 'module',
},
}),
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
}
},
//scss全局变量一个配置
css: {
preprocessorOptions: {
scss: {
javascriptEnabled: true,
additionalData: '@import "./src/styles/variable.scss";',
},
},
},
define: {
__SOURCE_REPOSITORIES__: JSON.stringify(require('./scripts/const').repos),
__MODEL_URL__: require('./script/model.json'),
},
server: {
// port: 8080,
proxy: {
'/api': {
target: 'http://localhost:8000',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '')
}
}
},
})