我已经安装了 react 三纤维 这是一个依赖项
"dependencies": {
"@react-three/drei": "^3.0.0",
"@testing-library/jest-dom": "^5.11.9",
"@testing-library/react": "^11.2.3",
"@testing-library/user-event": "^12.6.0",
"drei": "^2.2.21",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-scripts": "4.0.1",
"react-spring": "^8.0.27",
"react-three-fiber": "^5.3.18",
"three": "^0.125.1",
"web-vitals": "^0.2.4"
},
然后我运行npm i drei
之后,我尝试导入 useGLTF
import { useGLTF } from '@react-three/drei/useGLTF'
我得到了错误
./src/Components/Three/Scene.js
Module not found: Can't resolve '@react-three/drei/useGLTF' in 'D:\coding\react\mincraft\src\Components\Three'
我决定在 @react- Three/drei/useGLTF 中手动检查该文件 但没有诸如 useGLTF 之类的名称
我需要运行其他东西吗?
最佳答案
该死的。一段时间后,我在 drei/core/useGLTF 中发现了 useGLTF。
import { useGLTF } from '@react-three/drei/core/useGLTF'
关于javascript - 从 '@react-three/drei/useGLTF' 导入 useGLTF 导致找不到模块 :,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65950660/