Skip to content

feat(legacy): add rolldown-vite support #20417

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

sapphi-red
Copy link
Member

Description

This PR adds rolldown-vite support to plugin-legacy.

This PR achieves that by downloading a built package that is published to pkg.pr.new on rolldown-vite repo and vendoring + loading that in the package.

The upsides of this approach are:

  • the tests for rolldown-vite + plugin-legacy is done on rolldown-vite side and can be develeoped easier than having the source code of plugin-legacy for rolldown-vite in this repository
  • users won't need to switch the package to a different one

The downsides of this approach are:

  • the package size and download size is bigger due to some duplicated code and dependencies only used for rolldown-vite support. that said, rolldown-vite already depends on babel which is huge, so I think this is not a problem
  • exports other than viteLegacyPlugin/default should be synced between the normal plugin-legacy and the one for rolldown-vite support. this limitation should be fine.

To update the version for rolldown-vite support, we can update this line:

// for rolldown-vite v7.0.9, check https://pkg.pr.new/~/vitejs/rolldown-vite
const PLUGIN_LEGACY_FOR_ROLLDOWN_VITE =
'https://pkg.pr.new/vitejs/rolldown-vite/@vitejs/plugin-legacy@5c52bbc'

@sapphi-red sapphi-red added plugin: legacy p3-significant High priority enhancement (priority) labels Jul 17, 2025
@@ -32,8 +33,16 @@
},
"homepage": "https://github.com/vitejs/vite/tree/main/packages/plugin-legacy#readme",
"funding": "https://github.com/vitejs/vite?sponsor=1",
"imports": {
"#legacy-for-rolldown-vite": {
"types": "./vendor/legacy-for-rolldown-vite.d.ts",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is types need to be published?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't have to be. It is now removed from the published package (ca83b7d).

Copy link
Collaborator

@hi-ogawa hi-ogawa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@sapphi-red sapphi-red added this to the 7.1 milestone Jul 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3-significant High priority enhancement (priority) plugin: legacy
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants