Skip to content

Commit 3eda709

Browse files
committed
fix: evaluate bootstrapScriptContent import url on server
1 parent bff5ea1 commit 3eda709

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

packages/plugin-rsc/src/plugin.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -638,8 +638,16 @@ export default function vitePluginRsc(
638638
mergeAssetDeps(deps, entry.deps),
639639
)
640640
}
641+
let bootstrapScriptContent: string | RuntimeAsset
642+
if (typeof entryUrl === 'string') {
643+
bootstrapScriptContent = `import(${JSON.stringify(entryUrl)})`
644+
} else {
645+
bootstrapScriptContent = new RuntimeAsset(
646+
`"import(" + JSON.stringify(${entryUrl.runtime}) + ")"`,
647+
)
648+
}
641649
buildAssetsManifest = {
642-
bootstrapScriptContent: `import(${serializeValueWithRuntime(entryUrl)})`,
650+
bootstrapScriptContent,
643651
clientReferenceDeps,
644652
serverResources,
645653
}
@@ -1346,7 +1354,7 @@ function assetsURLOfDeps(deps: AssetDeps) {
13461354
//
13471355

13481356
export type AssetsManifest = {
1349-
bootstrapScriptContent: string
1357+
bootstrapScriptContent: string | RuntimeAsset
13501358
clientReferenceDeps: Record<string, AssetDeps>
13511359
serverResources?: Record<string, Pick<AssetDeps, 'css'>>
13521360
}

0 commit comments

Comments
 (0)