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
I have a very small entry file, which does a lazy glob import. None of the files that are resolved by this glob import have dependencies.
Vite injects a function in the output, that allows preloading any dependencies. However, this code is never used. This results in the output size being doubled, so this seems wasteful.
Suggested solution
It seems this code is injected as part of the buildImportAnalysisPlugin. It would be nice if the plugin was smart enough to detect if no async imports have any dependencies. In that case, the values of the object that import.meta.glob injects would not need to be wrapped with the preload function, and the preload function itself would not need to be injected. The following example is minified, but I think it's still sufficiently readable:
Description
I have a very small entry file, which does a lazy glob import. None of the files that are resolved by this glob import have dependencies.
Vite injects a function in the output, that allows preloading any dependencies. However, this code is never used. This results in the output size being doubled, so this seems wasteful.
Suggested solution
It seems this code is injected as part of the
buildImportAnalysisPlugin
. It would be nice if the plugin was smart enough to detect if no async imports have any dependencies. In that case, the values of the object thatimport.meta.glob
injects would not need to be wrapped with the preload function, and the preload function itself would not need to be injected. The following example is minified, but I think it's still sufficiently readable:In stead of:
You would just get:
Alternative
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: