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

Error: Failed to load external module @react-three/fiber: TypeError: Cannot read properties of undefined (reading 'ReactCurrentOwner') #3417

Open
raf-microsoft opened this issue Dec 19, 2024 · 2 comments

Comments

@raf-microsoft
Copy link

I'm having this issue in the new Next.js 15.1.0 project:

image

I tried to clear npm_modules and install again, test a few other examples and add "use client". The same issue.
 
My component:

import { Suspense } from 'react'
import { Canvas } from '@react-three/fiber'

const Test = () => {

    return (
        <Canvas>
            <Suspense>
                Test
            </Suspense>
        </Canvas>
    );
};

export default Test;

next.config.js

import type { NextConfig } from "next";

const nextConfig: NextConfig = {
  reactStrictMode: false,
  distDir: 'build',
  images: {
    domains: ['localhost'],
  },
  transpilePackages: ['three'],
};

export default nextConfig;

part of the package.json

"dependencies": {
    "@fluentui-contrib/react-chat": "^0.1.10",
    "@fluentui/react-components": "^9.56.8",
    "@react-three/drei": "^9.120.4",
    "@react-three/fiber": "^8.17.10",
    "@types/three": "^0.171.0",
    "next": "15.1.0",
    "react": "^19.0.0",
    "react-dom": "^19.0.0",
    "three": "^0.171.0"
  },
@raf-microsoft
Copy link
Author

Ok, I found the answer here: vercel/next.js#66468 @react-three/fiber has no support for React 19. You need to use @react-three/fiber@alpha when you're using Next.js 15. Problem patched with the alpha version.

@taseenb
Copy link

taseenb commented Dec 20, 2024

RC1 works with react 19: https://www.npmjs.com/package/@react-three/fiber/v/9.0.0-rc.1

But it crashes with Drei Bvh component.

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

2 participants