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

Not working with nextjs 14+ #15

Open
bastiankistner opened this issue Dec 21, 2023 · 4 comments
Open

Not working with nextjs 14+ #15

bastiankistner opened this issue Dec 21, 2023 · 4 comments

Comments

@bastiankistner
Copy link

I tried the offscreen canvas with nextjs 14 but it doesn't load the model. Tried it first in my own project and all I see is the fallback. Then checked out this repo and it works fine until I upgrade nextjs to the most recent version. The screen remains blank.

Does anyone happen to know what could be the reason?

@MrUltimate
Copy link

Hey @bastiankistner, did you ever figure out how to use this with NextJS?

@zknicker
Copy link

This is likely a symptom of Workers being broken in Next 14.1.0 and onwards.

Tracking issue for a fix: vercel/next.js#60920

In the meantime, pin your Next version to 14.0.4 of earlier and it will probably fix the issue. I'm rolling my own solution for Worker + ThreeJS, not react-three-offscreen, so can't verify, but it should be the same thing more or less.

@mofJon
Copy link

mofJon commented Apr 18, 2024

Anything further on this issue?

It's apparently been fixed in next canary (vercel/next.js#62051), but the issue in R3F/offscreen remains?

Fallback throws;
Error: Element type is invalid. Received a promise that resolves to: [object Object]. Lazy element type must resolve to a class or function.

Disabling fallback seems to load the scene and the model, but doesn't render anything to screen.

@mofJon
Copy link

mofJon commented Apr 18, 2024

I get closer with setting reactStrictMode: false in next.config

ie... displays the scene on screen, but doesn't render materials.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants