Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[rcr, Flight] Add throwing RSC entrypoint for compiler-runtime #32056

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

eps1lon
Copy link
Collaborator

@eps1lon eps1lon commented Jan 13, 2025

Summary

Alternate to #29057
Closes #31702

Adds a throwing stub to react-compiler-runtime and react/compiler-runtime if the react-server import condition is set that throw:

The React Compiler is currently not supported in a React Server environment.
Ensure that modules imported with a `react-server` condition are not compiled with the React Compiler.
Libraries should provide a dedicated `react-server` entrypoint that wasn't compiled with the React Compiler.

For react-compiler-runtime I had to add exports so this is technically a breaking change. Though I think we consider this only to be used as a Compiler target so any react-compiler-runtime/dist/* or react-compiler-runtime/src/* imports are already out of SemVer guarantees I guess?

How did you test this change?

Tested react/compiler-runtime with CSB artifacts merged with a local yarn build react-compiler-runtime.react-server,react/compiler-runtime

react-compiler-runtime I just manually checked that dist/ is as expected:

$ ls dist
index.d.ts                index.js.map              index.react-server.js.map
index.js                  index.react-server.js

@react-sizebot
Copy link

react-sizebot commented Jan 13, 2025

Comparing: b3a95ca...f26ce6a

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.js = 6.68 kB 6.68 kB +0.16% 1.83 kB 1.83 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 514.24 kB 514.24 kB = 91.74 kB 91.74 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.69 kB 6.69 kB +0.16% 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 556.18 kB 556.18 kB = 98.72 kB 98.72 kB
facebook-www/ReactDOM-prod.classic.js = 595.79 kB 595.79 kB = 104.85 kB 104.85 kB
facebook-www/ReactDOM-prod.modern.js = 586.21 kB 586.21 kB = 103.30 kB 103.30 kB
oss-experimental/react/cjs/react-compiler-runtime.react-server.development.js +∞% 0.00 kB 0.64 kB +∞% 0.00 kB 0.38 kB
oss-experimental/react/cjs/react-compiler-runtime.react-server.production.js +∞% 0.00 kB 0.80 kB +∞% 0.00 kB 0.46 kB
oss-experimental/react/compiler-runtime.react-server.js +∞% 0.00 kB 0.44 kB +∞% 0.00 kB 0.27 kB
oss-stable-semver/react/cjs/react-compiler-runtime.react-server.development.js +∞% 0.00 kB 0.64 kB +∞% 0.00 kB 0.38 kB
oss-stable-semver/react/cjs/react-compiler-runtime.react-server.production.js +∞% 0.00 kB 0.80 kB +∞% 0.00 kB 0.46 kB
oss-stable-semver/react/compiler-runtime.react-server.js +∞% 0.00 kB 0.44 kB +∞% 0.00 kB 0.27 kB
oss-stable/react/cjs/react-compiler-runtime.react-server.development.js +∞% 0.00 kB 0.64 kB +∞% 0.00 kB 0.38 kB
oss-stable/react/cjs/react-compiler-runtime.react-server.production.js +∞% 0.00 kB 0.80 kB +∞% 0.00 kB 0.46 kB
oss-stable/react/compiler-runtime.react-server.js +∞% 0.00 kB 0.44 kB +∞% 0.00 kB 0.27 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-experimental/react/cjs/react-compiler-runtime.react-server.development.js +∞% 0.00 kB 0.64 kB +∞% 0.00 kB 0.38 kB
oss-experimental/react/cjs/react-compiler-runtime.react-server.production.js +∞% 0.00 kB 0.80 kB +∞% 0.00 kB 0.46 kB
oss-experimental/react/compiler-runtime.react-server.js +∞% 0.00 kB 0.44 kB +∞% 0.00 kB 0.27 kB
oss-stable-semver/react/cjs/react-compiler-runtime.react-server.development.js +∞% 0.00 kB 0.64 kB +∞% 0.00 kB 0.38 kB
oss-stable-semver/react/cjs/react-compiler-runtime.react-server.production.js +∞% 0.00 kB 0.80 kB +∞% 0.00 kB 0.46 kB
oss-stable-semver/react/compiler-runtime.react-server.js +∞% 0.00 kB 0.44 kB +∞% 0.00 kB 0.27 kB
oss-stable/react/cjs/react-compiler-runtime.react-server.development.js +∞% 0.00 kB 0.64 kB +∞% 0.00 kB 0.38 kB
oss-stable/react/cjs/react-compiler-runtime.react-server.production.js +∞% 0.00 kB 0.80 kB +∞% 0.00 kB 0.46 kB
oss-stable/react/compiler-runtime.react-server.js +∞% 0.00 kB 0.44 kB +∞% 0.00 kB 0.27 kB

Generated by 🚫 dangerJS against 33c78b3

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Compiler Bug]: server components built externally by the compiler error when rendered in app
4 participants