Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/plugin-rsc/e2e/bundled-dev.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { test } from '@playwright/test'
import { useFixture } from './fixture'
import { defineStarterTest } from './starter'

// `experimental.bundledDev` runs a client Rollup build in dev, which used to
// crash the assets-manifest `generateBundle` hook (no RSC bundle in dev).
test.describe('bundled-dev', () => {
const f = useFixture({
root: 'examples/starter',
mode: 'dev',
command: 'pnpm dev --experimental-bundle',
})
defineStarterTest(f)
})
8 changes: 8 additions & 0 deletions packages/plugin-rsc/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1121,6 +1121,14 @@ export function createRpcClient(params) {
},
// client build
generateBundle(_options, bundle) {
// In bundledDev the client environment runs a Rollup build while
// `mode === 'dev'`, so this hook fires even though there is no RSC
// build output. The build-only asset copying and `buildAssetsManifest`
// construction below assume a production build (`manager.bundles['rsc']`
// is populated); in dev the manifest is served by the `load` hook above
// instead. Skip the build-only work in dev to avoid crashing on the
// absent RSC bundle.
if (this.environment.mode === 'dev') return
// copy assets from rsc build to client build
if (this.environment.name === 'client') {
const rscBundle = manager.bundles['rsc']!
Expand Down