From db0fa1e1035e853298774d2ee821f513b92ab83f Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Mon, 25 Mar 2024 12:18:09 +0800 Subject: [PATCH] chore: create shared common chunks during the ui build (#5580) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #### What type of PR is this? /area ui /kind improvement /milestone 2.14.x #### What this PR does / why we need it: 对 UI 的部分依赖进行分包处理。改动之后,如果下次构建 Halo,而这些依赖没有进行变更,那么 vendor 的 hash 后缀就不会变更,用户在升级之后这些依赖也可以有效命中缓存。 image #### Does this PR introduce a user-facing change? ```release-note 对 UI 的部分依赖进行分包处理。 ``` --- ui/src/vite/config-builder.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/ui/src/vite/config-builder.ts b/ui/src/vite/config-builder.ts index ae70b5c08..2f3387243 100644 --- a/ui/src/vite/config-builder.ts +++ b/ui/src/vite/config-builder.ts @@ -79,6 +79,24 @@ export function createViteConfig(options: Options) { outDir: path.resolve(rootDir, outDir), emptyOutDir: true, chunkSizeWarningLimit: 2048, + rollupOptions: { + output: { + manualChunks: { + vendor: [ + "lodash-es", + "axios", + "vue-grid-layout", + "transliteration", + "vuedraggable", + "emoji-mart", + "colorjs.io", + "jsencrypt", + "overlayscrollbars", + "overlayscrollbars-vue", + ], + }, + }, + }, }, }); }