Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: expose vite's default manualChunks function #5585

Closed
wants to merge 2 commits into from

Conversation

ygj6
Copy link
Member

@ygj6 ygj6 commented Nov 8, 2021

Description

fix: #5487

  • The easiest way is to expose createMoveToVendorChunkFn so that users can reuse it in custom manualChunks.
  • Merging is also a way, but after that, the user cannot completely override the vite default manualChunks, and the vendor.hash.js will 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?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the Commit Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@patak-dev patak-dev added the p2-nice-to-have Not breaking anything but nice to have (priority) label Nov 8, 2021
@@ -2,6 +2,8 @@ import path from 'path'
import { defineConfig } from 'vite'
import vuePlugin from '@vitejs/plugin-vue'
import { vueI18nPlugin } from './CustomBlockPlugin'
import { createMoveToVendorChunkFn } from 'vite'
const viteChunks = createMoveToVendorChunkFn()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-analyzed the building logic, the problem does exist, I will push a new commit for review : )

Copy link
Member Author

@ygj6 ygj6 Nov 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@ygj6 ygj6 changed the title feat: expose createMoveToVendorChunkFn API to partially override it feat: expose vite's default manualChunks function Nov 10, 2021
@ygj6 ygj6 mentioned this pull request Nov 25, 2021
9 tasks
@Shinigami92 Shinigami92 self-requested a review December 17, 2021 13:55
Comment on lines +564 to +565
// clear cache for parallel builds
cacheVendorChunks.clear()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p2-nice-to-have Not breaking anything but nice to have (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow partial override of rollup manualChunks
2 participants