Skip to content

feat(rsc): add customBuildApp option #1052

Merged
hi-ogawa merged 7 commits intomainfrom
feat/rsc-custom-build-pipeline
Jan 15, 2026
Merged

feat(rsc): add customBuildApp option #1052
hi-ogawa merged 7 commits intomainfrom
feat/rsc-custom-build-pipeline

Conversation

@hi-ogawa
Copy link
Copy Markdown
Contributor

@hi-ogawa hi-ogawa commented Jan 14, 2026

(Sorry if anyone got pinged by this PR. It wasn't intended and AI did it 😓)

Summary

This PR adds a customBuildApp option that allows downstream frameworks to skip the default buildApp orchestration and implement their own build order.

Motivation

The RSC plugin currently has a hardcoded build pipeline:

  • rsc -> ssr -> rsc -> client -> ssr (5 steps with 2 scan build)

With a new API, it allows taking over build pipeline to match framework's need. For example, following is from No SSR example:

// vite.config.ts
import rsc, { getPluginApi } from '@vitejs/plugin-rsc'

export default defineConfig({
  plugins: [
    rsc({
      entries: {
        rsc: './src/framework/entry.rsc.tsx',
      },
      customBuildApp: true,
    }),
  ],
  builder: {
    sharedPlugins: true,
    sharedConfigBuild: true,
    async buildApp(builder) {
      const { manager } = getPluginApi(builder.config)!

      // Scan
      manager.isScanBuild = true
      builder.environments.rsc!.config.build.write = false
      builder.environments.client!.config.build.write = false
      await builder.build(builder.environments.rsc!)
      await builder.build(builder.environments.client!)
      builder.environments.rsc!.config.build.write = true
      builder.environments.client!.config.build.write = true
      manager.isScanBuild = false
      manager.stabilize()

      // Build
      await builder.build(builder.environments.rsc!)
      await builder.build(builder.environments.client!)

      // write manifest
      manager.writeAssetsManifest(['rsc'])
    },
  },
})

🤖 Generated with Claude Code

@hi-ogawa hi-ogawa force-pushed the feat/rsc-custom-build-pipeline branch from 18945c4 to 18bb788 Compare January 14, 2026 08:54
Add `customBuildApp` option that allows downstream frameworks to
skip the default buildApp orchestration and implement their own build
order using the exposed `builder.rsc` API.

When `customBuildApp: true`:
- Default 4/5-step build orchestration is skipped
- `builder.rsc.manager` provides access to RscPluginManager
- `builder.rsc.writeAssetsManifest()` writes manifest to appropriate environments

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@hi-ogawa hi-ogawa force-pushed the feat/rsc-custom-build-pipeline branch from 18bb788 to dc239d6 Compare January 14, 2026 08:57
@hi-ogawa hi-ogawa added the trigger: preview Trigger pkg.pr.new label Jan 14, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Jan 14, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@vitejs/plugin-react@1052
npm i https://pkg.pr.new/@vitejs/plugin-react-oxc@1052
npm i https://pkg.pr.new/@vitejs/plugin-rsc@1052
npm i https://pkg.pr.new/@vitejs/plugin-react-swc@1052

commit: fd861a5

@hi-ogawa hi-ogawa changed the title feat(rsc): expose builder.rsc API for custom build pipelines feat(rsc): expose builder.rsc API for custom build pipelines (experimental) Jan 14, 2026
- Resolved conflict by keeping nested outdir handling from main
- Updated to use manager.writeAssetsManifest() instead of standalone function
@hi-ogawa hi-ogawa changed the title feat(rsc): expose builder.rsc API for custom build pipelines (experimental) feat(rsc): add customBuildApp option Jan 15, 2026
@hi-ogawa hi-ogawa merged commit 8aaab1b into main Jan 15, 2026
18 of 22 checks passed
@hi-ogawa hi-ogawa deleted the feat/rsc-custom-build-pipeline branch January 15, 2026 02:09
@silvenon
Copy link
Copy Markdown

Pretty cool about this flexibility! Also makes it more transparent.

Btw, looking at this config I'm a little unclear on whether sharedConfigBuild: true implies sharedPlugins: true or not? I thought it did.

@hi-ogawa
Copy link
Copy Markdown
Contributor Author

Pretty cool about this flexibility! Also makes it more transparent.

Btw, looking at this config I'm a little unclear on whether sharedConfigBuild: true implies sharedPlugins: true or not? I thought it did.

If I remember correctly, one implies another but forgot which is which, so just went with setting both 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

trigger: preview Trigger pkg.pr.new

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants