File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ import {
4444 getEntrySource ,
4545 hashString ,
4646 normalizeRelativePath ,
47- normalizeServerHandler ,
47+ getFetchHandlerExport ,
4848 sortObject ,
4949 withRollupError ,
5050} from './plugins/utils'
@@ -514,7 +514,7 @@ export default function vitePluginRsc(
514514 `[vite-rsc] failed to resolve server handler '${ source } '` ,
515515 )
516516 const mod = await environment . runner . import ( resolved . id )
517- const fetchHandler = normalizeServerHandler ( mod )
517+ const fetchHandler = getFetchHandlerExport ( mod )
518518 // expose original request url to server handler.
519519 // for example, this restores `base` which is automatically stripped by Vite.
520520 // https://github.com/vitejs/vite/blob/84079a84ad94de4c1ef4f1bdb2ab448ff2c01196/packages/vite/src/node/server/middlewares/base.ts#L18-L20
@@ -542,7 +542,7 @@ export default function vitePluginRsc(
542542 )
543543 const entry = pathToFileURL ( entryFile ) . href
544544 const mod = await import ( /* @vite -ignore */ entry )
545- const fetchHandler = normalizeServerHandler ( mod )
545+ const fetchHandler = getFetchHandlerExport ( mod )
546546 const handler = createRequestListener ( fetchHandler )
547547
548548 // disable compressions since it breaks html streaming
Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ export function hashString(v: string): string {
8484// https://srvx.h3.dev/guide
8585// https://vercel.com/docs/functions/functions-api-reference?framework=other#fetch-web-standard
8686// https://github.com/jacob-ebey/rsbuild-rsc-playground/blob/eb1a54afa49cbc5ff93c315744d7754d5ed63498/plugin/fetch-server.ts#L59-L79
87- export function normalizeServerHandler ( exports : object ) : any {
87+ export function getFetchHandlerExport ( exports : object ) : any {
8888 if ( 'default' in exports ) {
8989 const default_ = exports . default
9090 if (
You can’t perform that action at this time.
0 commit comments