Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 21, 2025

Copilot's imcomplete work
  • Add spaPlugin() to serve index.html before RSC (like no-ssr)
  • Configure RSC environment with browser platform
  • Add process.env.NODE_ENV definition
  • Add async_hooks polyfill for browser compatibility
  • Fix node:async_hooks import resolution issue

Current Status

The example now loads the HTML page correctly, but there's still an issue with Node.js built-in modules:

  • The RSC environment tries to import node:async_hooks which doesn't exist in browsers
  • Created a polyfill but the alias resolution isn't working yet
  • The module runner is successfully invoked but fails when loading RSC dependencies

##Need to resolve

The fundamental challenge is that React Server Components use Node.js APIs (async_hooks, process, etc.) that aren't available in browsers. The RSC environment needs to be configured to work with browser-compatible versions of these APIs when loaded via module runner.

Original prompt

This section details on the original issue you should resolve

<issue_title>Add example which runs react-server conditioned environment with module runner on browser</issue_title>
<issue_description>- this is a variant of packages/plugin-rsc/examples/no-ssr and packages/plugin-rsc/examples/browser-mode

  • runs rsc environment of packages/plugin-rsc/examples/no-ssr on browser via module runner like packages/plugin-rsc/examples/browser-mode/src/framework/load-client-dev.tsx
  • add examples/browser-mode2</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #932


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Add example for running react-server in browser mode Add browser-mode2 example: hybrid RSC with module runner Oct 21, 2025
Copilot finished work on behalf of hi-ogawa October 21, 2025 13:05
Copilot AI requested a review from hi-ogawa October 21, 2025 13:05
Copilot finished work on behalf of hi-ogawa October 21, 2025 13:14
Copy link
Contributor

@hi-ogawa hi-ogawa left a comment

Choose a reason for hiding this comment

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

@copilot getPluginApi should be unnecessary. focus on dev only first.

Copy link
Contributor Author

Copilot AI commented Oct 21, 2025

@copilot getPluginApi should be unnecessary. focus on dev only first.

Done in commit e8c5a89. Removed getPluginApi and all build-time virtual modules, now focusing on dev-only.

Copilot AI changed the title Add browser-mode2 example: hybrid RSC with module runner Add browser-mode2 example: hybrid RSC with module runner (dev-only) Oct 21, 2025
Copilot finished work on behalf of hi-ogawa October 21, 2025 13:21
Copilot AI requested a review from hi-ogawa October 21, 2025 13:21
Copilot finished work on behalf of hi-ogawa October 21, 2025 13:26
@hi-ogawa
Copy link
Contributor

@copilot try again.

Copy link
Contributor Author

Copilot AI commented Oct 21, 2025

@copilot try again.

Added e2e test in commit 4f24bd6. The test follows the same structure as no-ssr and uses defineStarterTest with the 'browser-mode' variant.

Copilot AI changed the title Add browser-mode2 example: hybrid RSC with module runner (dev-only) Add browser-mode2 example: hybrid RSC with module runner Oct 21, 2025
Copilot finished work on behalf of hi-ogawa October 21, 2025 16:04
@hi-ogawa
Copy link
Contributor

@copilot debug e2e failure

Copy link
Contributor Author

Copilot AI commented Oct 21, 2025

@copilot debug e2e failure

Identified the issue - the RSC environment is trying to import Node.js built-ins like node:async_hooks which don't exist in browsers. Added spaPlugin to serve HTML correctly and configured RSC environment with browser platform, but need to resolve the Node.js module imports. The module runner successfully connects but fails when loading RSC dependencies that require Node.js APIs.

Working on finding the right approach to polyfill or alias these Node.js modules for browser execution.

Copilot finished work on behalf of hi-ogawa October 21, 2025 16:25
@hi-ogawa hi-ogawa changed the title Add browser-mode2 example: hybrid RSC with module runner chore(rsc): example of rsc environment on browser module runner Oct 22, 2025
@hi-ogawa hi-ogawa marked this pull request as ready for review October 22, 2025 04:37
@hi-ogawa hi-ogawa merged commit 26f0f20 into main Oct 23, 2025
20 checks passed
@hi-ogawa hi-ogawa deleted the copilot/add-browser-mode2-example branch October 23, 2025 02:08
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.

Add example which runs react-server conditioned environment with module runner on browser

2 participants