feat: expose vite's default manualChunks function#5585
feat: expose vite's default manualChunks function#5585ygj6 wants to merge 2 commits intovitejs:mainfrom
Conversation
| import vuePlugin from '@vitejs/plugin-vue' | ||
| import { vueI18nPlugin } from './CustomBlockPlugin' | ||
| import { createMoveToVendorChunkFn } from 'vite' | ||
| const viteChunks = createMoveToVendorChunkFn() |
There was a problem hiding this comment.
The cache is not going to be cleaned up correctly during build watch if it is defined in this way. I think we are having an issue in Vite here, no? This cache should be cleaned in buildStart. Maybe we should move it out of the function, and into the plugin control.
Maybe we could end up exposing a single function instead of factory afterwards?
There was a problem hiding this comment.
Re-analyzed the building logic, the problem does exist, I will push a new commit for review : )
There was a problem hiding this comment.
Please focus on checking whether it needs to be cleared here?
b9f1826#diff-aa53520bfd53e6c24220c44494457cc66370fd2bee513c15f9be7eb537a363e7R564-R565
Will the parallelCallCounts introduced by 4a955bc actually be greater than 1? I tested several scenarios that I expected and found nothing. If it is greater than, maybe parallel build will affect the shared cache?
Open a new thread below for tracking.
| // clear cache for parallel builds | ||
| cacheVendorChunks.clear() |
There was a problem hiding this comment.
Please focus on checking whether it needs to be cleared here?
Will the parallelCallCounts introduced by 4a955bc actually be greater than 1? I tested several scenarios that I expected and found nothing. If it is greater than, maybe parallel build will affect the shared cache?
Description
fix: #5487
createMoveToVendorChunkFnso that users can reuse it in custommanualChunks.manualChunks, and thevendor.hash.jswill always output. Maybe we can add an option to turn it on or off, thinking we need to discuss 🤔Additional context
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123).