bugfix: use explicit export block in SSR bridge to fix Rolldown/Vite+ builds#1098
Merged
justinvdm merged 1 commit intoredwoodjs:mainfrom Mar 22, 2026
Merged
Conversation
The destructured `export const { renderHtmlStream: e, ... }` pattern
exports mangled single-letter bindings after minification. Rolldown
(Vite+) does strict static analysis and correctly rejects imports of the
original names. Switch to local destructuring + `export { ... }` block,
which minifiers always preserve.
Collaborator
|
Thank you so much @joefairburn! Both for testing rwsdk out with vite+, then fixing what you ran into 🙇 Change makes total sense 👍 |
Collaborator
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 #1097
ssrBridgeWrapPluginwraps the SSR bridge output in an IIFE during Rollup'srenderChunkhook. After this, Vite's esbuild minification mangles the destructured binding names (renderHtmlStream: e,ssrLoadModule: t, etc.), so the actual ES module exports become single-letter variablesMISSING_EXPORTerrors. Rollup seems to be more lenient, and doesn't throw errors for this.export const { renderHtmlStream, ... } = (function() { ... })()to local destructuring + a separateexport { ... }block, which minifiers always preserveTest plan
vp buildfails without the fix (MISSING_EXPORTx3)vp buildpasses with the fixvite buildstill passes (hello-world playground)