diff --git a/packages/vite/src/react-server-dom-webpack/node-loader.ts b/packages/vite/src/react-server-dom-webpack/node-loader.ts index 86e53bd005e7..fd7135a8c845 100644 --- a/packages/vite/src/react-server-dom-webpack/node-loader.ts +++ b/packages/vite/src/react-server-dom-webpack/node-loader.ts @@ -290,6 +290,9 @@ function resolveClientImport( ) } +/** + * Parses `body` for exports and stores them in `names` (the second argument) + */ async function parseExportNamesIntoNames( body: any, names: Array, @@ -334,6 +337,7 @@ async function parseExportNamesIntoNames( } await parseExportNamesIntoNames(childBody, names, url, loader) + continue } @@ -431,7 +435,9 @@ async function loadClientImport( throw new Error( 'Expected getSource to have been called before transformSource' ) - } // TODO: Validate that this is another module by calling getFormat. + } + + // TODO: Validate that this is another module by calling getFormat. const getSourceContext = { format: 'module' } const { source } = await stashedGetSource( @@ -537,9 +543,7 @@ export async function transformSource( } ) - return { - source: newSrc, - } + return { source: newSrc } } return transformed diff --git a/packages/vite/src/rsc/rscVitePlugins.ts b/packages/vite/src/rsc/rscVitePlugins.ts index e3b99a936e0b..a09826c75f00 100644 --- a/packages/vite/src/rsc/rscVitePlugins.ts +++ b/packages/vite/src/rsc/rscVitePlugins.ts @@ -116,6 +116,7 @@ export function rscTransformPlugin(): Plugin { } const mod = await RSDWNodeLoader.load(id, null, load) + return mod.source }, }