-
-
Notifications
You must be signed in to change notification settings - Fork 191
Add browser-mode2 example combining full RSC plugin with browser-mode execution #937
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
Co-authored-by: hi-ogawa <[email protected]>
| configureServer(server) { | ||
| server.middlewares.use(async (req, res, next) => { | ||
| const url = new URL(req.url ?? '/', 'https://any.local') | ||
| if (url.pathname === '/@vite/invoke-react-client') { | ||
| const payload = JSON.parse(url.searchParams.get('data')!) | ||
| const result = | ||
| await server.environments['react_client']!.hot.handleInvoke( | ||
| payload, | ||
| ) | ||
| res.setHeader('Content-Type', 'application/json') | ||
| res.end(JSON.stringify(result)) | ||
| return | ||
| } | ||
| next() | ||
| }) | ||
| }, |
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.
@copilot rscBrowserMode2Plugin shouldn't be needed except /@vite/invoke-rsc middleware.
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.
Simplified rscBrowserMode2Plugin to only include the essential browser-mode specific parts:
/@vite/invoke-react-clientmiddleware- Virtual module for load-client
- Minimal react_client environment config
- Hot reload handler
Removed redundant config that the full RSC plugin already handles. (commit: simplified)
Co-authored-by: hi-ogawa <[email protected]>
Co-authored-by: hi-ogawa <[email protected]>
Co-authored-by: hi-ogawa <[email protected]>
Co-authored-by: hi-ogawa <[email protected]>
|
#933 got right eventually |
react-serverconditioned environment with module runner on browser #932 requirementsimport rsc from '@vitejs/plugin-rsc'Changes Made
Simplified
rscBrowserMode2Pluginto only include essential browser-mode specific configuration:/@vite/invoke-react-clientmiddleware for module runner communicationload-clientreact_clientenvironment configurationRemoved redundant configuration that the full RSC plugin already handles:
This aligns with the architecture where the full RSC plugin handles core RSC functionality, and the custom plugin only adds browser-mode specific features.
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.