Skip to content
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

Next.js+ React 19 incompatible with the code that was precompiled using react compiler #74182

Open
faradaytrs opened this issue Dec 20, 2024 · 1 comment
Labels
bug Issue was opened via the bug report template. Runtime Related to Node.js or Edge Runtime with Next.js.

Comments

@faradaytrs
Copy link

faradaytrs commented Dec 20, 2024

Link to the code that reproduces this issue

https://codesandbox.io/p/devbox/frosty-bird-xx8pz9

To Reproduce

Import components from packages precompiled using the babel-plugin-react-compiler targeting React 19.
Build and run a Next.js project using the app directory and the precompiled dependencies.

Screenshot 2024-12-20 at 16 54 52

Current vs. Expected behavior

The Next.js project builds and runs without errors during prerendering or runtime.
• Precompiled packages function correctly with React 19 and the updated React Compiler.
• Build errors during prerendering in the Next.js project.
• Runtime errors in react-compiler-runtime.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.1.0: Thu Oct 10 21:02:26 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T8122
  Available memory (MB): 24576
  Available CPU cores: 8
Binaries:
  Node: 23.3.0
  npm: 10.9.0
  Yarn: N/A
  pnpm: 9.15.0
Relevant Packages:
  next: 15.1.2
  eslint-config-next: N/A
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.7.2
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Runtime

Which stage(s) are affected? (Select all that apply)

next dev (local), next build (local), next start (local), Vercel (Deployed)

Additional context

I believe it's because nextjs isn't really using stable react build.

@faradaytrs faradaytrs added the bug Issue was opened via the bug report template. label Dec 20, 2024
@github-actions github-actions bot added the Runtime Related to Node.js or Edge Runtime with Next.js. label Dec 20, 2024
@faradaytrs
Copy link
Author

faradaytrs commented Dec 20, 2024

This setup worked fine till we upgraded to react 19

Screenshot 2024-12-20 at 16 57 26

We precompile UI libraries and don't rely on bundler in the nextjs project, it's recommended setup by react team.

At this point we are not ready to use nextjs reactCompiler experimental feature, we just want to use precompiled libraries in our NextJS project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template. Runtime Related to Node.js or Edge Runtime with Next.js.
Projects
None yet
Development

No branches or pull requests

1 participant