-
Notifications
You must be signed in to change notification settings - Fork 27.7k
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
[Block] 14.1.0 next dev
throw error Attempted import error: 'useLayoutEffect' is not exported from 'react' (imported as 'useLayoutEffect').
#61185
Comments
Very similar bug: #60890 |
I encountered exactly the same error after update on 14.1.0. Don't understand how, but
with remove |
Getting the same error |
I was getting same error this tip resolved it temporarily until its fixed.👍
|
what if i do need this field for other purposes? is there a way for next.js build to not look at the browserList field even when its there? |
This is a joke, how do you suggest to upgrade to the latest version with stupid errors like this? Thank god all I have to do is delete a .next folder and a property from package.json.... When will this fix be released? @huozhi ? Btw, thanks for the work around @zamarawka |
We had a fix in #61791 and released in v14.1.1-canary.44 for this issue, please upgrade to any canary versions above that one |
### What Exclude precompiled react packages from browser layer loaders coverage. ### Why Since we're transpiling all the browser layer code now after #59569, then SWC will also compile react. But when it compiles `react.production.min.js` it gives me with the code and ESM helper inserted ```js import { _ as _type_of } from "@swc/helpers/_/_type_of"; // This is not correct var l = Symbol.for("react.element"), n = Symbol.for("react.portal"), p = Symbol.for("react.fragment"), q = Sym bol.for("react.strict_mode"), r = Symbol.for("react.profiler"), t = Symbol.for("react.provider"), u = Symbol.f ``` This makes bundler think it's a ESM package but actually it's CJS, which converts the module into `{ default: .., __esModule }` instead of the original react module. When you're using `React.useEffect` or other API through namespace import (`import * as React from 'react'`), this will break the module exports check in bundling as the property doesn't directly attached to the module now. This PR disabled the transform for precompiled react packages now and will see the deeper issue in next-swc side later. Fixes #60890 Fixes #61185 Closes NEXT-2362
still having this error on latest canary build on edge runtime |
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Link to the code that reproduces this issue
https://github.com/tianyingchun/next-issue
To Reproduce
Current vs. Expected behavior
throw error in
next dev mode
yarn build works fine.
Provide environment information
- info Server env(s) validation successful: Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:34 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T8103 Binaries: Node: 20.10.0 npm: 10.2.3 Yarn: 4.0.2 pnpm: N/A Relevant Packages: next: 14.1.0 eslint-config-next: 14.1.0 react: 18.2.0 react-dom: 18.2.0 typescript: 5.3.3 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
App Router
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
next dev
can works correct on"next": "14.0.4",
next dev
can not works correct on"next": "14.1.0",
next build
can works correct both on 14.0.4 and 14.1.0****The text was updated successfully, but these errors were encountered: