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

Doesn't seem to work with Next.js 15 (React 19) #66

Open
ynamite opened this issue Nov 8, 2024 · 3 comments · May be fixed by #69
Open

Doesn't seem to work with Next.js 15 (React 19) #66

ynamite opened this issue Nov 8, 2024 · 3 comments · May be fixed by #69

Comments

@ynamite
Copy link

ynamite commented Nov 8, 2024

After upgrading to Next.js 15, I get the following error when importing. Everything worked great with Next.js 14.2.7.

TypeError: Cannot read properties of undefined (reading 'ReactCurrentDispatcher') at http://localhost:3000/_next/static/chunks/node_modules__pnpm_157f4a._.js:26220:19 at vr (http://localhost:3000/_next/static/chunks/node_modules__pnpm_157f4a._.js:26621:6) at [project]/node_modules/.pnpm/[email protected]_@[email protected]_@[email protected]_react-d_fbv5bfsjqsehsl6cjhgfvaqu2a/node_modules/three-custom-shader-material/three-custom-shader-material.es.js [app-client] (ecmascript) (http://localhost:3000/_next/static/chunks/node_modules__pnpm_157f4a._.js:26623:90) at http://localhost:3000/_next/static/chunks/_8b5f57._.js:693:27 at runModuleExecutionHooks (http://localhost:3000/_next/static/chunks/_8b5f57._.js:738:9) at instantiateModule (http://localhost:3000/_next/static/chunks/_8b5f57._.js:691:9) at getOrInstantiateModuleFromParent (http://localhost:3000/_next/static/chunks/_8b5f57._.js:624:12) at esmImport (http://localhost:3000/_next/static/chunks/_8b5f57._.js:142:20) at [project]/components/3D/Materials/PlanetMaterial.tsx [app-client] (ecmascript) (http://localhost:3000/_next/static/chunks/_e03f14._.js:3622:417) at http://localhost:3000/_next/static/chunks/_8b5f57._.js:693:27 at runModuleExecutionHooks (http://localhost:3000/_next/static/chunks/_8b5f57._.js:738:9) at instantiateModule (http://localhost:3000/_next/static/chunks/_8b5f57._.js:691:9) at getOrInstantiateModuleFromParent (http://localhost:3000/_next/static/chunks/_8b5f57._.js:624:12) at esmImport (http://localhost:3000/_next/static/chunks/_8b5f57._.js:142:20) at [project]/components/3D/Models/Planet.tsx [app-client] (ecmascript) (http://localhost:3000/_next/static/chunks/_e03f14._.js:4642:155) at http://localhost:3000/_next/static/chunks/_8b5f57._.js:693:27 at runModuleExecutionHooks (http://localhost:3000/_next/static/chunks/_8b5f57._.js:738:9) at instantiateModule (http://localhost:3000/_next/static/chunks/_8b5f57._.js:691:9) at getOrInstantiateModuleFromParent (http://localhost:3000/_next/static/chunks/_8b5f57._.js:624:12) at esmImport (http://localhost:3000/_next/static/chunks/_8b5f57._.js:142:20) at [project]/components/3D/Scenes/Planets.tsx [app-client] (ecmascript) (http://localhost:3000/_next/static/chunks/_e03f14._.js:5079:144) at http://localhost:3000/_next/static/chunks/_8b5f57._.js:693:27 at runModuleExecutionHooks (http://localhost:3000/_next/static/chunks/_8b5f57._.js:738:9) at instantiateModule (http://localhost:3000/_next/static/chunks/_8b5f57._.js:691:9) at getOrInstantiateModuleFromParent (http://localhost:3000/_next/static/chunks/_8b5f57._.js:624:12) at esmImport (http://localhost:3000/_next/static/chunks/_8b5f57._.js:142:20) at [project]/components/3D/Scene.tsx [app-client] (ecmascript) (http://localhost:3000/_next/static/chunks/_e03f14._.js:5802:145) at http://localhost:3000/_next/static/chunks/_8b5f57._.js:693:27 at runModuleExecutionHooks (http://localhost:3000/_next/static/chunks/_8b5f57._.js:738:9) at instantiateModule (http://localhost:3000/_next/static/chunks/_8b5f57._.js:691:9) at getOrInstantiateModuleFromParent (http://localhost:3000/_next/static/chunks/_8b5f57._.js:624:12) at commonJsRequire (http://localhost:3000/_next/static/chunks/_8b5f57._.js:157:20) at requireModule (http://localhost:3000/_next/static/chunks/0bc23_next_dist_compiled_f5d8d0._.js:2671:29) at initializeModuleChunk (http://localhost:3000/_next/static/chunks/0bc23_next_dist_compiled_f5d8d0._.js:3213:25) at readChunk (http://localhost:3000/_next/static/chunks/0bc23_next_dist_compiled_f5d8d0._.js:3118:17) at react-stack-bottom-frame (http://localhost:3000/_next/static/chunks/0bc23_next_dist_compiled_react-dom_f5cd7a._.js:12453:20) at beginWork (http://localhost:3000/_next/static/chunks/0bc23_next_dist_compiled_react-dom_f5cd7a._.js:5335:77) at runWithFiberInDEV (http://localhost:3000/_next/static/chunks/0bc23_next_dist_compiled_react-dom_f5cd7a._.js:631:20) at performUnitOfWork (http://localhost:3000/_next/static/chunks/0bc23_next_dist_compiled_react-dom_f5cd7a._.js:7936:97) at workLoopSync (http://localhost:3000/_next/static/chunks/0bc23_next_dist_compiled_react-dom_f5cd7a._.js:7829:40) at renderRootSync (http://localhost:3000/_next/static/chunks/0bc23_next_dist_compiled_react-dom_f5cd7a._.js:7810:13) at performWorkOnRoot (http://localhost:3000/_next/static/chunks/0bc23_next_dist_compiled_react-dom_f5cd7a._.js:7553:148) at performWorkOnRootViaSchedulerTask (http://localhost:3000/_next/static/chunks/0bc23_next_dist_compiled_react-dom_f5cd7a._.js:8387:9) at MessagePort.performWorkUntilDeadline (http://localhost:3000/_next/static/chunks/0bc23_next_dist_compiled_f5d8d0._.js:2348:64)

@FarazzShaikh
Copy link
Owner

FarazzShaikh commented Nov 8, 2024

This is because React 19 is a breaking change. I will upgrade to React 19 once R3F releases v9. Untill then, it is not possible to use CSM in React 19. You can follow R3F v9 here: pmndrs/react-three-fiber#2338

Vanilla version should still work though, please confirm if it does.

import CSM from "three-custom-shader-material/vanilla"

@FarazzShaikh FarazzShaikh changed the title Doesn't seem to work with Next.js 15 Doesn't seem to work with Next.js 15 (React 19) Nov 8, 2024
@ynamite
Copy link
Author

ynamite commented Nov 9, 2024

Oh I see thanks!
I‘ll try using vanilla version and report back.

@ynamite
Copy link
Author

ynamite commented Nov 12, 2024

Vanilla works, thanks for the suggestion.

Unfortunately, a lot of things regarding R3F, Drei and maybe even CSM (hard to know which error stems from where) don't work with React 19, so I'm going back to Next 14 and React 18 :)

@KlotzJesse KlotzJesse linked a pull request Nov 22, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants