Skip to content

Conversation

hi-ogawa
Copy link
Collaborator

@hi-ogawa hi-ogawa commented Jul 27, 2025

This PR adds a blog post to accompany with #1493. Used lots of AI 😅

Copy link

vercel bot commented Jul 27, 2025

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

Name Status Preview Updated (UTC)
waku ✅ Ready (Inspect) Visit Preview Aug 5, 2025 1:32am

Copy link

codesandbox-ci bot commented Jul 27, 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.

Copy link

pkg-pr-new bot commented Jul 27, 2025

Open in StackBlitz

npm i https://pkg.pr.new/wakujs/waku@1564

commit: 7292761

@hi-ogawa hi-ogawa changed the title chore: add blog post for @vitejs/plugin-rsc migration docs: add blog post for @vitejs/plugin-rsc migration Jul 28, 2025
hi-ogawa and others added 2 commits July 29, 2025 17:30
Polish intro paragraph with proper spacing and improve Future section with prose instead of bullet points. Better explains ecosystem benefits and standardized approach.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
hi-ogawa and others added 2 commits July 29, 2025 17:59
Clarify that deployment adapter integrations are future work and reduce repetition of "standardized" by using "unified approach" in second paragraph.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@hi-ogawa hi-ogawa marked this pull request as ready for review July 29, 2025 09:13
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.

Thanks so much for writing up a post!

@dai-shi
Copy link
Member

dai-shi commented Jul 29, 2025

@sandren Can you review please?

@dai-shi dai-shi requested a review from sandren July 29, 2025 13:49
Updated the description to be more concise and engaging, matching the style of other blog posts. Changed from technical implementation details to focus on the key outcome and benefits.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@dai-shi dai-shi marked this pull request as draft August 2, 2025 00:52
@dai-shi dai-shi marked this pull request as ready for review August 2, 2025 23:45
dai-shi pushed a commit that referenced this pull request Aug 3, 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.

```sh
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

- new `{ vite: ... }` config in `waku.config.ts`
- this replaces custom `vite.config.ts` and `unstable_viteConfigs` in
`waku.config.ts`
- custom plugin can access environment API configuration and plugin
system
    - https://vite.dev/guide/api-environment.html
    - https://vite.dev/guide/api-environment-plugins.html

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

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

- `ssr` environment (previously "main server ssr") doesn't externalize
server deps by default, but transform all react deps.
- This means if there's cjs dependency (directly or transitively) used
in client component, SSR might fail during dev. For example, `swr` (esm)
package uses `use-sync-external-store` (cjs) internally. This can be
mitigated by `environments.ssr.optimizeDeps.include: ["swr"]`.
  - See also vitejs/vite-plugin-react#610

## e2e status

Run it locally e.g. by

```js
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
```

- [x] broken-links
- [x] create-pages
- [x] define-router
- [x] fs-router
- [x] hot-reload
- [x] monorepo
- [x] multi-platform
- [x] partial-build
- [x] render-type
- [x] rsc-asset
- [x] rsc-basic
- [x] rsc-css-modules
- [x] ssg-performance
- [x] ssg-wildcard
- [x] ssr-basic
- [x] ssr-catch-error
- [x] ssr-context-provider
- [x] ssr-redirect
- [x] ssr-swr
- [x] ssr-target-bundle
- [x] use-router
- [x] examples-smoke
  - [x] 11_fs-router (build)
  - [x] 12_nossr (build)
  - [x] 36_form (see #1534)
  - [x] 38_cookies (build)
  - [x] website

## todo 

- [x] test: `waitForHydration` or not?
#1493 (comment)
- [x] reduce diff
- [ ] announcement #1564
- [ ] discuss dependency structure (dep vs peer-dep,
`@hiogawa/vite-plugin` or wait for it to move to vitejs org)
- [ ] replace completely hi-ogawa#20
- [x] test: fix windows ci fail
hi-ogawa#11
- [x] deployment adapter hi-ogawa#8
  - vercel example https://waku-vite-rsc-01-template.vercel.app
- [x] "use client" transform with `allowServer`
hi-ogawa/vite-plugins#1078
- [x] improve waku.config support
hi-ogawa#5
- [x] polish middleware hi-ogawa#7
- [x] integrate hono hi-ogawa#6
- [ ] check if any known issues will be fixed by this change. (if it's
still not working, check if it's also reproduce with
https://github.com/hi-ogawa/vite-plugins/tree/main/packages/rsc and
raise it as an upstream issue)
Copy link
Collaborator

@sandren sandren left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks! ☺️

@dai-shi dai-shi merged commit c575dba into wakujs:main Aug 5, 2025
28 checks passed
@hi-ogawa hi-ogawa deleted the chore-vite-rsc-blog branch August 5, 2025 02:32
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