brianzinn / react-babylonjs

React for Babylon 3D engine
https://brianzinn.github.io/react-babylonjs/
817 stars 105 forks source link

Unhandled Rejection (Error): Cannot find module '@babylonjs/core/Maths/math' #137

Closed JLTG2020 closed 3 years ago

JLTG2020 commented 3 years ago

When I use react-babylonjs I get this error.

截屏2021-05-31 下午4 48 46

But when I use babylonjs directly,Everything is OK.

brianzinn commented 3 years ago

What version of @babylonjs/core are you using?

JLTG2020 commented 3 years ago

What version of @babylonjs/core are you using?

4.2.0

brianzinn commented 3 years ago

I think you need to clear node_modules directory and install again.

JLTG2020 commented 3 years ago

I think you need to clear node_modules directory and install again.

Thank you

JLTG2020 commented 3 years ago

I try to clear node_modules and yarn.lock.But it is not work.This is my repo: https://github.com/JLTG2020/react-ts-quick-starter I cannot find any problem.Please help me, Thank you very much!

brianzinn commented 3 years ago

hi @JLTG2020 sorry, I did not see that you had re-opened this issue. What I did was downgrade to react-babylonjs@2.3.2 and was able to get your repo started. One big difference from 3.0 was that I added to package.json "type": "module",. If I remove that from the react-babylonjs package.json then your project does load even on @latest. I would defer this as a bug in your starter webpack configuration, since this project is correctly type "module". Please re-open if you have more questions. I stopped supported cjs quite a while ago (it was just one line in rollup configuration, though), since I am not expecting people using React to need commonjs.

brianzinn commented 3 years ago

I will fix this - sorry that I closed it as I thought it was the other project misconfigured. #148 has same issue.

brianzinn commented 3 years ago

hi @JLTG2020 - I think it is fixed in 3.0.19. I was able to load your example repo with my latest version linked. Can you confirm if it is working for you now?

brianzinn commented 3 years ago

The other issue (148) with Webpack 5 has confirmed that it looks fixed. Please re-open if you have any questions or it still doesn't work for you. Cheers.