In bundledDev mode the client environment runs a Rollup build while
mode === 'dev', so the assets-manifest generateBundle hook fires even
though no RSC build output exists. It then reads manager.bundles['rsc']
(populated only by a production build) and crashes with
'TypeError: Cannot convert undefined or null to object'.
The dev manifest is already served by the load hook, so the build-only
asset copying and buildAssetsManifest construction are unnecessary in dev.
Return early when mode === 'dev'.
Context
experimental.bundledDev: true crashes the dev server on startup:
TypeError: Cannot convert undefined or null to object at generateBundle (virtual:vite-rsc/assets-manifest)The assets-manifest manifest is served two ways: the load hook builds it in dev, and generateBundle builds it in production from manager.bundles['rsc']. In normal dev, generateBundle never runs. In bundledDev the client environment runs a Rollup build while mode === 'dev', so generateBundle fires, but there's no RSC build, so manager.bundles['rsc'] is undefined and Object.values(rscBundle) throws.
The fix is to return early from generateBundle in dev, since the load hook already provides the manifest there.
(Production builds and are unaffected)
Testing