fix(types): widen RollupConfig.plugins to accept Rolldown-typed plugins [v3] - #4483
Open
dargmuesli wants to merge 1 commit into
Open
fix(types): widen RollupConfig.plugins to accept Rolldown-typed plugins [v3]#4483dargmuesli wants to merge 1 commit into
dargmuesli wants to merge 1 commit into
Conversation
Vite 8 changed its own Plugin type to extend Rolldown.Plugin, so plugin factories typed against Vite (e.g. @vitejs/plugin-vue's vue()) no longer satisfy rollupConfig.plugins, which is typed against real Rollup's Plugin. rollupConfig is already reused for the rolldown builder internally, so widen the public type and keep the two real rollup() call sites strict via a local cast. Fixes nitrojs#4482
|
@dargmuesli is attempting to deploy a commit to the Nitro Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
📝 WalkthroughWalkthroughChangesRollup plugin typing
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
commit: |
This was referenced Jul 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #4482.
Vite 8 changed its own
Plugintype toextends Rolldown.Plugin<A>(Vite now bundles Rolldown as its internal bundler instead of Rollup+esbuild). Any plugin factory typed against Vite'sPlugin, e.g.@vitejs/plugin-vue'svue(), is therefore now structurally a Rolldown plugin. Nitro'srollupConfig.pluginsis typed against therolluppackage'sPlugin, so passing a Vite 8 plugin there no longer type-checks.nitro.options.rollupConfigis already deliberately reused across both therollupandrolldownbuilders (see the// Added for backward compatibilitycasts insrc/build/vite/bundler.ts) so this widens the publicpluginsfield to accept either bundler's plugin shape, and adds a narrowas RollupOptionscast at the two places that call therolluppackage (rollup.rollup(),rollup.watch()), which still need the strict, Rollup-only type.Note: this targets main, companion PR for v2 now open there: #4484.
Changes
src/types/build.ts:RollupConfig.pluginsis nowRollupInputOptions["plugins"] | RolldownInputOptions["plugins"]instead of being locked to Rollup's own type.src/build/rollup/prod.ts: castrollupConfigtoRollupOptionsat therollup.rollup()call site.src/build/rollup/dev.ts: same cast at therollup.watch()call site.