Skip to content

feat(rsc): expose module runner CJS transform#1265

Open
TheAlexLichter wants to merge 1 commit into
vitejs:mainfrom
TheAlexLichter:experiment/export-rsc-cjs-transform
Open

feat(rsc): expose module runner CJS transform#1265
TheAlexLichter wants to merge 1 commit into
vitejs:mainfrom
TheAlexLichter:experiment/export-rsc-cjs-transform

Conversation

@TheAlexLichter

@TheAlexLichter TheAlexLichter commented Jun 21, 2026

Copy link
Copy Markdown
Member

Description

This PR exports the RSC module runner’s CommonJS-to-ESM transform and documents how frameworks can apply it to application .cjs files.

Why

The built-in RSC CJS plugin only transforms eligible dependencies from node_modules. Frameworks may also need to run CJS application modules through Vite’s server module runner.

Without this export, frameworks must duplicate the RSC-specific CJS conversion logic or depend on an internal module.

Exposing the transform provides a supported low-level API while leaving file selection and dynamic require() policy to the integrating framework.

Note: This is only relevant if the framework wants to support user-authored or generated .cjs server entries. To my knowledge, this could be beneficial for vinext, marko-js and earthquake.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant