-
-
Notifications
You must be signed in to change notification settings - Fork 165
docs: add blog post for @vitejs/plugin-rsc
migration
#1564
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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. |
commit: |
@vitejs/plugin-rsc
migration@vitejs/plugin-rsc
migration
167fd84
to
6fad5cb
Compare
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>
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>
There was a problem hiding this 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!
@sandren Can you review please? |
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>
(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)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks!
This PR adds a blog post to accompany with #1493. Used lots of AI 😅