-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
feat(plugin-legacy): add option to output only legacy builds #10139
Conversation
Please notice my PR #9920 that basically omits entirely CSS inlining for legacy, and instead (pre)load the same CSS chunks both for modern and legacy. |
350b411
to
a99eade
Compare
@lsdsjy sorry for the delay to review this PR. I've added it to our team board to be discussed in a future team meeting. Would you comment on your use case for this feature? Are you targeting a specific browser inside a private setup that can't be upgraded I imagine? If this is a public app, most users will benefit from our current default scheme. To give visibility, there is a forked plugin in case this is needed before: npmjs.com/package/vite-plugin-legacy-no-module |
This reverts commit 2e63b8a.
a99eade
to
92278ef
Compare
Yes. It's hard to explain though. It's important for us that the zipped archive of all dist files is small while still compatible with legacy devices, so we can't afford to have an extra set of dist files for modern devices.
I see. This PR had changes with vite core to enforce CSS inlining, so it was not feasible to only use a plugin. But thanks to #10496, a forked plugin can be a temporary workaround now. And I've reverted a99eade in my PR accordingly. |
As a workaround, I can tell you that you can just delete all the output chunk files that doesn't ends up with vite/playground/legacy/vite.config.js Lines 33 to 43 in 934a304
|
Yes, @Tal500 has a point too. I don't know if we can justify the option just to speed up a bit plugin legacy here if there is a good way to remove the files after you build. We'll be discussing it in a future team meeting to see what is the best. The linked issues have several folks doing +1 to it, so maybe an option is indeed justified. |
Yes, it's basically what the prior work in #9458 does, while there's a little waste of computation. |
any progress about this feature? |
Hey @aleen42, when there is progress in a PR or issue, we always comment on them so there is no need to ask that question (here or on other open-source projects) In particular, this issue is in the backlog on our Team board, but we haven't had time to check it out yet. |
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.
LGTM
@sapphi-red Once check is dead! |
💥💥💥 |
Hi @lsdsjy @Kingwl , could you try this feature yet? I used |
Same here, how can fix |
I found out the reason, I saw in manifest.json we have vite/legacy-polyfills-legacy file, we have to include this polyfill-legacy file into the script before the entry point to load all necessary polyfills. Hope that helps you @dante01yoon 👍 |
thank you for comment, where manifest.json located? |
In vite.config.js, you will have |
Description
Fixes #9050
Additional context
This PR is a continuation of #9458 and adopts @sapphi-red 's suggestion. By controlling
rollupOptions.output
, the plugin skips modern bundle generating at all, which.css
files and<link>
tags because legacy chunks will inline CSS text.Besides, I have changed the option's name to
renderModernChunks
, which is easier to understand considering the existingrenderLegacyChunks
option.What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).