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

react-dom does not have correct exports when in client component and runtime experimental-edge #47057

Closed
1 task done
mmahalwy opened this issue Mar 13, 2023 · 8 comments
Closed
1 task done
Labels
bug Issue was opened via the bug report template. locked please verify canary The issue should be verified against next@canary. It will be closed after 30 days of inactivity

Comments

@mmahalwy
Copy link

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: darwin
      Arch: arm64
      Version: Darwin Kernel Version 22.1.0: Sun Oct  9 20:15:09 PDT 2022; root:xnu-8792.41.9~2/RELEASE_ARM64_T6000
    Binaries:
      Node: 16.15.0
      npm: 8.5.5
      Yarn: 1.22.18
      pnpm: N/A
    Relevant packages:
      next: 13.2.3
      eslint-config-next: 13.2.2
      react: 18.2.0
      react-dom: 18.2.0


### Which area(s) of Next.js are affected? (leave empty if unsure)

_No response_

### Link to the code that reproduces this issue

https://codesandbox.io/p/sandbox/github/vercel/next.js/tree/canary/examples/reproduction-template?file=%2FREADME.md&selection=%5B%7B%22endColumn%22%3A1%2C%22endLineNumber%22%3A8%2C%22startColumn%22%3A1%2C%22startLineNumber%22%3A8%7D%5D

### To Reproduce

1. Use experimental `appDir`
2. Use experimental `runtime: experiment-edge`

Notice that ReactDOM exports:

{
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: [Getter],
createPortal: [Getter],
flushSync: [Getter],
preinit: [Getter],
preload: [Getter],
version: [Getter],
default: [Getter]
}

This is missing other exports that ReactDom exports such as `unstable_batchedUpdates`

### Describe the Bug

ReactDOM missing certain exports when edge runtime is enabled. 

### Expected Behavior

ReactDOM exports should be the same

### Which browser are you using? (if relevant)

_No response_

### How are you deploying your application? (if relevant)

_No response_
@mmahalwy mmahalwy added the bug Issue was opened via the bug report template. label Mar 13, 2023
@lunoob
Copy link

lunoob commented Apr 27, 2023

some issue

@fubhy
Copy link

fubhy commented May 11, 2023

This is a problem with things like react-query, redux, etc. that expect unstable_batchedUpdates. I'm sure there are other packages that depend on this.

./cc @jxom this atm. breaks wagmi with next.js 13 & edge runtime.

@leerob leerob added the please verify canary The issue should be verified against next@canary. It will be closed after 30 days of inactivity label Jun 19, 2023
@github-actions
Copy link
Contributor

Please verify that your issue can be recreated with next@canary.

Why was this issue marked with the please verify canary label?

We noticed the provided reproduction was using an older version of Next.js, instead of canary.

The canary version of Next.js ships daily and includes all features and fixes that have not been released to the stable version yet. You can think of canary as a public beta. Some issues may already be fixed in the canary version, so please verify that your issue reproduces by running npm install next@canary and test it in your project, using your reproduction steps.

If the issue does not reproduce with the canary version, then it has already been fixed and this issue can be closed.

How can I quickly verify if my issue has been fixed in canary?

The safest way is to install next@canary in your project and test it, but you can also search through closed Next.js issues for duplicates or check the Next.js releases. You can also use the GitHub templates (preferred) for pages and App Router, or the CodeSandbox: pages or CodeSandbox: App Router templates to create a reproduction with canary from scratch.

My issue has been open for a long time, why do I need to verify canary now?

Next.js does not backport bug fixes to older versions of Next.js. Instead, we are trying to introduce only a minimal amount of breaking changes between major releases.

What happens if I don't verify against the canary version of Next.js?

An issue with the please verify canary that receives no meaningful activity (e.g. new comments that acknowledge verification against canary) will be automatically closed and locked after 30 days.

If your issue has not been resolved in that time and it has been closed/locked, please open a new issue, with the required reproduction, using next@canary.

I did not open this issue, but it is relevant to me, what can I do to help?

Anyone experiencing the same issue is welcome to provide a minimal reproduction following the above steps. Furthermore, you can upvote the issue using the 👍 reaction on the topmost comment (please do not comment "I have the same issue" without reproduction steps). Then, we can sort issues by votes to prioritize.

I think my reproduction is good enough, why aren't you looking into it quicker?

We look into every Next.js issue and constantly monitor open issues for new comments.

However, sometimes we might miss one or two due to the popularity/high traffic of the repository. We apologize, and kindly ask you to refrain from tagging core maintainers, as that will usually not result in increased priority.

Upvoting issues to show your interest will help us prioritize and address them as quickly as possible. That said, every issue is important to us, and if an issue gets closed by accident, we encourage you to open a new one linking to the old issue and we will look into it.

Useful Resources

@leerob
Copy link
Member

leerob commented Jun 19, 2023

^ Please verify with the stable App Router (no flag needed) and stable edge (no experimental- needed)

@GabeDuarteM
Copy link

@leerob For me this still happens with the latest canary version, and latest versions for react-query:

> next build

- info Loaded env from <path>/.env
- warn You are using an experimental edge runtime, the API might change.
Failed to compile.

../../node_modules/.pnpm/@tanstack+react-query@4.29.14_react-dom@18.2.0_react@18.2.0/node_modules/@tanstack/react-query/build/lib/reactBatchedUpdates.mjs
Attempted import error: 'unstable_batchedUpdates' is not exported from 'react-dom' (imported as 'ReactDOM').

Import trace for requested module:
../../node_modules/.pnpm/@tanstack+react-query@4.29.14_react-dom@18.2.0_react@18.2.0/node_modules/@tanstack/react-query/build/lib/reactBatchedUpdates.mjs
../../node_modules/.pnpm/@tanstack+react-query@4.29.14_react-dom@18.2.0_react@18.2.0/node_modules/@tanstack/react-query/build/lib/setBatchUpdatesFn.mjs
../../node_modules/.pnpm/@tanstack+react-query@4.29.14_react-dom@18.2.0_react@18.2.0/node_modules/@tanstack/react-query/build/lib/index.mjs
./File.tsx


> Build failed because of webpack errors
- info Creating an optimized production build . ELIFECYCLE  Command failed with exit code 1.

I'll try to provide a reproducible repo soon

@GabeDuarteM
Copy link

GabeDuarteM commented Jun 19, 2023

Got a minimal reproducible repo:

https://github.com/GabeDuarteM/nextjs-bug-unstable_batchedUpdates

To get the error, just clone the repo and do a npm install and npm run build

@ztanner
Copy link
Member

ztanner commented Jul 20, 2023

This should be fixed by facebook/react#27028 -- please feel free to open a new issue with a repro if you're still running into this problem!

@ztanner ztanner closed this as completed Jul 20, 2023
@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. locked please verify canary The issue should be verified against next@canary. It will be closed after 30 days of inactivity
Projects
None yet
Development

No branches or pull requests

7 participants