From 18534306eb030b2ee1382503bbc53aa3f6f08b71 Mon Sep 17 00:00:00 2001 From: JamesChenX Date: Sun, 3 Dec 2023 15:16:40 +0800 Subject: [PATCH] Split turms-admin output JS bundle to improve page load speed --- turms-admin/vite.config.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/turms-admin/vite.config.ts b/turms-admin/vite.config.ts index 63bfb2713f..959949a845 100644 --- a/turms-admin/vite.config.ts +++ b/turms-admin/vite.config.ts @@ -1,6 +1,6 @@ import { fileURLToPath, URL } from 'node:url'; import autoprefixer from 'autoprefixer'; -import { defineConfig } from 'vite'; +import { defineConfig, splitVendorChunkPlugin } from 'vite'; import vue from '@vitejs/plugin-vue'; import Components from 'unplugin-vue-components/vite'; import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers'; @@ -49,6 +49,9 @@ export default defineConfig(({mode }) => ({ importStyle: false })] }), + // We don't split vendor into more chunks because + // it will cause chunks to run in wrong order. + splitVendorChunkPlugin(), isReportMode ? visualizer({ filename: './build/.cache/stats.html',