pmndrs / drei

🥉 useful helpers for react-three-fiber
https://docs.pmnd.rs/drei
MIT License
8.46k stars 714 forks source link

Beta version isn't working #820

Closed TiagoCavalcante closed 2 years ago

TiagoCavalcante commented 2 years ago

Problem description:

The beta version isn't working with React-Native because of a missing dependency: three-mesh-bvh

Relevant code:

expo init MyProject
cd MyProject
npm i react@rc
npm i three
npm i @react-three/fiber@beta --legacy-peer-deps
npm i @react-three/drei@beta --legacy-peer-deps
# modify any file in the project so it imports @react-three/drei
npm start
# Open the page and press "Run in browser/Android/iOS there
# See the bug

Suggested solution:

I don't know what can be done, I have also tried installing that package by myself but the error is still there.

Shipeijing commented 2 years ago

I also encountered this problem

JSneak commented 2 years ago

I am also having this issue. Are there any updates?

Edit: I'm using the "@react-three/drei/native" and am having this same issue

JSneak commented 2 years ago

I found this in the discord, but this in my metro.config.js fixed it for me

module.exports = {
    resolver: {
      sourceExts: ['jsx', 'js', 'ts', 'tsx','umd','cjs'], 
    },
  };

fixed the issue for me

CodyJasonBennett commented 2 years ago

Is UMD relevant for three-mesh-bvh? I have cjs for https://docs.pmnd.rs/react-three-fiber/getting-started/installation#react-native but I'll have to amend it in that case.

TiagoCavalcante commented 2 years ago

The latest version with React 18 is working now.