-
-
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: legacy no resolve asset urls #9507
Conversation
https://github.com/poyoho/vite/blob/c1eb9b0d225e9688558af4a0145960bb93a5accd/packages/vite/src/node/plugins/css.ts#L566 what mean of |
It seems that it means "async css are inlined for legacy bundle" 🤔 |
IIUC, now is ok 😁 |
Co-authored-by: 翠 / green <green@sapphi.red>
Co-authored-by: 翠 / green <green@sapphi.red>
Co-authored-by: 翠 / green <green@sapphi.red>
https://github.com/poyoho/vite/blob/2d7812af07f872d21e4c4288b1fbdb66795133c7/packages/vite/src/node/plugins/css.ts#L475 this variable is seems must be |
b4bdafa
to
2fd5069
Compare
Yes, rollup seems to avoid generating For legacy chunks maybe we can add |
Oh, I really didn't expect this one, sorry I approved this one 👀. |
Ah, yes. We'll need to do a similar thing there, too.
Yeah, I hope it but I don't have good idea to use it here. We are using rollup's chunk generating mechanism to collect css into chunks. So we need to use |
Co-authored-by: 翠 / green <green@sapphi.red>
Co-authored-by: 翠 / green <green@sapphi.red>
how about |
System.register('', function () {
function bar () {
console.log(arguments[1].meta.url) // here
}
bar()
}) |
It very hard to inject the |
I was thinking of something like: transform(code) {
return `${code};import.meta.url;`
} Not injecting in the actual position. (rollup might remove this with tree-shaking and I haven't tested this) |
But somewhere using |
emm... In this PR, must be hoist the css inject code in the global scoped. So I think About https://github.com/rollup/rollup/blob/a8647dac0fe46c86183be8596ef7de25bc5b4e4b/src/finalisers/system.ts#L39-L43. I think the How about force replace |
This one sounds good to me. |
Yes, that is a smart trick @poyoho! |
Co-authored-by: 翠 / green <green@sapphi.red>
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.
Thanks for tackling this!
Seconded, amazing how much complexity was unveiled by this issue. Thanks for pushing it til the end @poyoho. And your reviews on this one were great @sapphi-red |
This PR deepen my understanding of vite. Thanks for everyone's review |
Description
fix: #9530
fix: #9246
css-post plugin ignore processed vite asset flag.
If the css load by user normal plugins (vue plugin) will break the rule.
so we should
resolveAssetUrlsInCss
in legacy mode.Additional context
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).