-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: modulePreload false #13973
fix: modulePreload false #13973
Conversation
Run & review this pull request in StackBlitz Codeflow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can merge this as a stop gap for now. I also think it's not ideal, but I'm not really sure how to fix it. Maybe we can improve preloading overall later to tackle #13952, slim it down, different preloads for JS or CSS only, that PR to reduce preload deps string size etc at once.
Agreed. Not directly related, but the way we handle preloads may also get in the way to stabilize |
/ecosystem-ci run |
📝 Ran ecosystem CI: Open
|
Same CI fails as in main, merging |
vitejs/vite#13973 - above fix makes import.meta.glob to ignore 'modulePreload: false' option. so, css are preloaded by wrapper function and occurs error because wrapper function does not use chrome.runtime.getURL for css files. - so, prevented dynamic import from being wrapped by vite preloader.
Fixes #10773
Description
We currently share the same preload helper for injecting CSS stylesheets of dynamic imports. Even when
modulePreload
is set tofalse
, we still need the preload import helper and preserve the CSS styles for the dynamically imported module.We already had a test case for
modulePreload: false
, but one of the checks was wrong.This fix isn't ideal, users that set
modulePreload
false would probably expect the import helper to be avoided. But at least the behavior is correct after this PR.Related issue:
__vitePreload
if dependency array is empty #13952#13952 one isn't easy to solve as we need
import.meta.url
in the transform hook, and populate the deps for the dynamic import ingenerateBundle
. If we don't find a good way to find if the preload helper is needed at transform time, maybe we could at least reduce the helper that is quite verbose now with no deps and then replace it back ingenerateBundle
(even if we leave some white space to avoid messing with sourcemaps).What is the purpose of this pull request?