-
Notifications
You must be signed in to change notification settings - Fork 0
feat: use Vite RSC API #2
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
a31acf3 to
babc4fc
Compare
I think we should do this by default (but don't make it build error yet). Found while testing hi-ogawa/waku#2
|
This is amazing work. Thank you. I like how there are separate public, ssr, and rsc folders in a project built with waku/vite-rsc. I see that Waku could provide some default listeners for @hono/node-server, bun, hono/aws-lambda, cloudflare workers, etc. A Waku app could import one of those handlers or supply its own - maybe using a virtual module to import the RSC handler and pass it the Request object and handle the response. By default, for prod, it could bundle @hono/node-server or use vite preview. I like how the waku/vite-rsc demo here uses the environment API. That will make it possible to use the Cloudflare Vite plugin. I opened this discussion when the Cloudflare Vite plugin was announced with React Router support. wakujs#1388 It would be great to be able to customize the handler server entry that is used for prod and dev with the Environment API. When creating an app for Cloudflare Workers, the handler server entry could be customized to add additional handlers and durable objects. |
|
@rmarscher Thanks for testing out! I'm talking with Daishi and I'll soon move this PR to Waku repo for review and discussions. As to Cloudflare features, this change should make it easier to integrate their vite plugin both on dev and build. Not with Waku, but I have two examples here to use |
9307c73 to
732864f
Compare
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Co-authored-by: Hiroshi Ogawa <[email protected]> Co-authored-by: Daishi Kato <[email protected]>
Fixes: wakujs#1518 --------- Co-authored-by: Daishi Kato <[email protected]>
changelog: https://devblogs.microsoft.com/typescript/announcing-typescript-5-9/ I guess import defer could be an awesome feature we might use that (maybe)? Co-authored-by: Daishi Kato <[email protected]>
This adds a test case for fallback index.html as discussed in wakujs#1493 (comment)

Note
The PR is moved to the official repo wakujs#1493
old comment
This PR replaces Waku's
viteandreact-server-dom-webpackinternals with "Vite RSC API" provided by@hiogawa/vite-rscpackage. (It's currently my own package, but the plan is to move/split it to under@vitejs/plugin-rscandreact-server-dom-vitein the future. See also hi-ogawa/vite-plugins#1037)Currently the new code path is split in
waku/vite-rsc/...but most of Waku's core routing logic is reused internally. This mode is available by running the same cli with a flagwaku --experimental-vite-rsc. For example, you can try it out the default template by:The package is published on pkg.pr.new from the branch, so you can try it out on your project by installing https://pkg.pr.new/hi-ogawa/waku@(commit).
The goal is to achieve the switch without breaking change. 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!
e2e status
Run it locally e.g. by
✅: pass
⚠️ : pass but not functioning
❌: some fails
❓: flaky?
todo
allowServerfeat(rsc, transforms): support preserving client reference original value vite-plugins#1078stylexin server components wakujs/waku#750