Skip to content

Commit

Permalink
chore: create shared common chunks during the ui build (#5580)
Browse files Browse the repository at this point in the history
#### 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 后缀就不会变更,用户在升级之后这些依赖也可以有效命中缓存。

<img width="998" alt="image" src="https://github.com/halo-dev/halo/assets/21301288/60095e08-45f5-4b56-8f79-2999238ebfc5">

#### Does this PR introduce a user-facing change?

```release-note
对 UI 的部分依赖进行分包处理。
```
  • Loading branch information
ruibaby committed Mar 25, 2024
1 parent 2af9239 commit db0fa1e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions ui/src/vite/config-builder.ts
Expand Up @@ -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",
],
},
},
},
},
});
}

0 comments on commit db0fa1e

Please sign in to comment.