You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
splitVendorChunkPlugin not working with entry file from node_modules
The nuxt library provides an entry file from node_modules. The Vite plugin can't work with this.
Expected behavior
Vite generates 2 chunks: entry and vendors.
Actual behavior
Vite generates 1 entry chunk, which contains all dependencies (node_modules).
splitVendorChunkPlugin adds dependencies that were not in the original entry file.
Since the plugin performs a recursive search for importers, some dependencies may be marked as statically imported from the entry file, although this is not the case. In the example, this can be seen in the default chunk. These dependencies are used only in the default chunk, but they end up in the vendors chunk.
Expected behavior
The vendors chunk contains only those dependencies that were present in the original entry chunk.
Actual behavior
The vendors chunk contains dependencies that were not in the original entry chunk.
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
The splitVendorChunkPlugin was kept to allow projects have an easy path to be backward compatible. It is hard to implement a general solution for every project at the level Vite works. I think the best is that Nuxt offers users what works best for them.
I think we should remove the mention to it from the docs and deprecate it to be able to completely remove it in Vite 6.
Activity
patak-cat commentedon Mar 26, 2024
The
splitVendorChunkPluginwas kept to allow projects have an easy path to be backward compatible. It is hard to implement a general solution for every project at the level Vite works. I think the best is that Nuxt offers users what works best for them.I think we should remove the mention to it from the docs and deprecate it to be able to completely remove it in Vite 6.