Skip to content

Improvement: Add a log when react-dom is running on RSC instead of SSR #27478

Closed as not planned
@HenriqueLimas

Description

@HenriqueLimas

When a SSR file is being wrongly considered as an RSC, the error log is not easy to understand. After #27436 react-dom started importing only the react.shared-subset file and not the react.production. This causes the error here where ReactCurrentCache is undefined. Although this is the correct behavior, a better error message would help to understand the issue.

React version: canary, >= 18.3.0-canary-a6ed60a8e-20230929

Steps To Reproduce

  1. Wrongly consider an SSR file as part of RSC (react-server condition)

Link to code example: https://github.com/HenriqueLimas/rsc-example/tree/wrong-ssr

The current behavior

By running the code we receive this error

TypeError: Cannot read properties of undefined (reading 'current')

The expected behavior

A better error message similar to the one used on react-server (The "react" package in this environment is not configured correctly. `) would be better to understand the error

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution: StaleAutomatically closed due to inactivityStatus: UnconfirmedA potential issue that we haven't yet confirmed as a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions