Skip to content

Conversation

hi-ogawa
Copy link
Collaborator

@hi-ogawa hi-ogawa commented Jun 26, 2025

(EDIT: see also blog post for the summary #1564)

This PR replaces Waku's vite and react-server-dom-webpack internals with @vitejs/plugin-rsc.

The new code path is split in waku/src/vite-rsc/... but Waku's core routing logic is reused internally. Previously implementation is still preserved and can be enabled via a flag --experimental-legacy-cli e.g.

pnpm -C examples/01_template dev --experimental-legacy-cli

The goal is to achieve the switch with as little breaking change as possible. There are still missing pieces as I wrote in todo at the bottom, but the overall shape is mostly established, so I'm opening a PR here to start to gather feedback. Thanks!

known changes

// waku.config.ts
import { defineConfig } from "waku/config"

export default defineConfig({
  vite: {
    plugins: [ ... ],
    environments: {
      client: { ... },
      ssr: { ... },
      rsc: { ... },
    }
  }
})

e2e status

Run it locally e.g. by

TEST_VITE_RSC=1 pnpm exec playwright test --project=chromium-dev e2e/rsc-basic.spec.ts
pnpm -C e2e/fixtures/rsc-basic dev --experimental-vite-rsc
  • broken-links
  • create-pages
  • define-router
  • fs-router
  • hot-reload
  • monorepo
  • multi-platform
  • partial-build
  • render-type
  • rsc-asset
  • rsc-basic
  • rsc-css-modules
  • ssg-performance
  • ssg-wildcard
  • ssr-basic
  • ssr-catch-error
  • ssr-context-provider
  • ssr-redirect
  • ssr-swr
  • ssr-target-bundle
  • use-router
  • examples-smoke

todo

Copy link

vercel bot commented Jun 26, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Updated (UTC)
waku ⬜️ Ignored (Inspect) Visit Preview Aug 2, 2025 6:10am

Copy link

codesandbox-ci bot commented Jun 26, 2025

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@dai-shi
Copy link
Member

dai-shi commented Jun 26, 2025

Cool. Very nice work. So excited to see this will land once it's finished.
This PR includes some improvements that can be applied already.
Here's our strategy:

  • Split changes that are mergable to main, and merge them in advance
  • Create changes that help reduce diffs, and merge them in advance
  • Remove the experimental flag

Really our goal is gradually add changes as much as possible and make the final PR as minimal as possible.

dai-shi pushed a commit that referenced this pull request Jun 26, 2025
I extracted a change from #1493. I
found these two since my plugin rejects non async function with "use
server".
dai-shi pushed a commit that referenced this pull request Jun 26, 2025
Extracted from #1493. This for-loop
seems redundant since DEV / PROD runs are already split as playwright
projects.
@dai-shi dai-shi mentioned this pull request Jun 26, 2025
@hi-ogawa hi-ogawa force-pushed the chore-vite-rsc branch 3 times, most recently from 9307c73 to 732864f Compare June 27, 2025 02:41
Copy link
Member

@dai-shi dai-shi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some minor notes

@hi-ogawa hi-ogawa mentioned this pull request Aug 2, 2025
dai-shi pushed a commit that referenced this pull request Aug 2, 2025
This adds a test case for fallback index.html as discussed in
#1493 (comment)
Copy link
Member

@dai-shi dai-shi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll continue reviewing and refactoring after merging too.

@dai-shi dai-shi merged commit c2a21a1 into wakujs:main Aug 3, 2025
28 checks passed
@himself65
Copy link
Member

congrats!

@hi-ogawa
Copy link
Collaborator Author

hi-ogawa commented Aug 3, 2025

Thank you!

dai-shi added a commit that referenced this pull request Aug 5, 2025
This PR adds a blog post to accompany with
#1493. Used lots of AI 😅

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Daishi Kato <dai-shi@users.noreply.github.com>
@hi-ogawa hi-ogawa deleted the chore-vite-rsc branch August 5, 2025 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants