mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-06 18:36:55 +08:00
1
This commit is contained in:
@@ -9,7 +9,6 @@ import Markdown from 'unplugin-vue-markdown/vite'
|
|||||||
import { defineConfig } from 'vite'
|
import { defineConfig } from 'vite'
|
||||||
import svgLoader from 'vite-svg-loader'
|
import svgLoader from 'vite-svg-loader'
|
||||||
import { VineVitePlugin } from 'vue-vine/vite'
|
import { VineVitePlugin } from 'vue-vine/vite'
|
||||||
import { visualizer } from 'rollup-plugin-visualizer';
|
|
||||||
|
|
||||||
// 自定义SVGO插件,删除所有名称以sodipodi:和inkscape:开头的元素
|
// 自定义SVGO插件,删除所有名称以sodipodi:和inkscape:开头的元素
|
||||||
const removeSodipodiInkscape = {
|
const removeSodipodiInkscape = {
|
||||||
@@ -88,14 +87,6 @@ export default defineConfig({
|
|||||||
include: [/\.vue$/, /\.vue\?vue/, /\.md$/, /\.vine$/],
|
include: [/\.vue$/, /\.vue\?vue/, /\.md$/, /\.vine$/],
|
||||||
}),
|
}),
|
||||||
VineVitePlugin(),
|
VineVitePlugin(),
|
||||||
visualizer({
|
|
||||||
open: false, // 不自动打开浏览器,避免影响 CI/CD
|
|
||||||
gzipSize: true, // 显示 Gzip 压缩后的大小
|
|
||||||
brotliSize: true, // 显示 Brotli 压缩后的大小
|
|
||||||
filename: 'dist/stats.html', // 分析报告的输出路径
|
|
||||||
template: 'treemap', // 使用树图模式展示
|
|
||||||
sourcemap: true, // 使用 sourcemap 进行更精确的分析
|
|
||||||
}),
|
|
||||||
],
|
],
|
||||||
server: { port: 51000 },
|
server: { port: 51000 },
|
||||||
resolve: { alias: { '@': path.resolve(__dirname, 'src') } },
|
resolve: { alias: { '@': path.resolve(__dirname, 'src') } },
|
||||||
@@ -105,29 +96,28 @@ export default defineConfig({
|
|||||||
'__BUILD_TIME__': JSON.stringify(new Date().toISOString()),
|
'__BUILD_TIME__': JSON.stringify(new Date().toISOString()),
|
||||||
},
|
},
|
||||||
optimizeDeps: {
|
optimizeDeps: {
|
||||||
include: [
|
include: ['@vicons/fluent', '@vicons/ionicons5', 'vue', 'vue-router'],
|
||||||
'vue',
|
|
||||||
'vue-router',
|
|
||||||
'pinia',
|
|
||||||
'@vueuse/core',
|
|
||||||
'naive-ui',
|
|
||||||
'date-fns',
|
|
||||||
'@vicons/fluent',
|
|
||||||
'@vicons/ionicons5',
|
|
||||||
],
|
|
||||||
exclude: ['@tauri-apps/api', '@tauri-apps/plugin-autostart', '@tauri-apps/plugin-http'],
|
|
||||||
},
|
},
|
||||||
build: {
|
build: {
|
||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
target: 'esnext',
|
target: 'esnext',
|
||||||
minify: 'oxc',
|
minify: 'oxc',
|
||||||
chunkSizeWarningLimit: 1600, // 调整警告阈值,gamepad-assets 会比较大
|
chunkSizeWarningLimit: 1000,
|
||||||
cssCodeSplit: true,
|
|
||||||
cssMinify: 'lightningcss',
|
|
||||||
assetsInlineLimit: 4096, // 4KB,默认值,可根据需要调整
|
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
output: {
|
output: { // @ts-ignore
|
||||||
advancedChunks: {
|
advancedChunks: {
|
||||||
|
groups: [
|
||||||
|
{
|
||||||
|
name: 'vue-vendor',
|
||||||
|
test: /[\\/]node_modules[\\/](vue|vue-router|pinia)[\\/]/,
|
||||||
|
priority: -10,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'ui-vendor',
|
||||||
|
test: /[\\/]node_modules[\\/](naive-ui|@vueuse[\\/]core)[\\/]/,
|
||||||
|
priority: -10,
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user