将drei加入react-three-fiber导致报错
Adding drei to react-three-fiber causes error
我正在做一个 react-three-fiber 项目,我像过去一样添加了 drei。
npm i drei
问题是,一旦我尝试使用 Html 方面,它就会抛出一个关于如何找不到曲线修饰符的错误。我过去用过 drei 没有问题,但我不知道如何处理这个问题。
Module not found: Can't resolve 'three/examples/jsm/modifiers/CurveModifier' in '/Users/....'
导入语句:
import { Html } from "@react-three/drei";
package.json 文件的一部分
"dependencies": {
"@react-three/drei": "2.2.18",
"axios": "0.19.2",
"chroma-js": "2.1.0",
"next": "9.5.0",
"next-redux-wrapper": "6.0.2",
"prop-types": "15.7.2",
"ramda": "0.27.0",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-redux": "7.2.1",
"react-three-fiber": "4.2.18",
"redux": "4.0.5",
"redux-devtools-extension": "2.13.8",
"redux-saga": "1.1.3",
"three": "0.119.0"
}
CurveModifier 是一项新的三项功能。要么更新 threejs,要么做 import { Html } from "@react-three/drei/Html";
我正在做一个 react-three-fiber 项目,我像过去一样添加了 drei。
npm i drei
问题是,一旦我尝试使用 Html 方面,它就会抛出一个关于如何找不到曲线修饰符的错误。我过去用过 drei 没有问题,但我不知道如何处理这个问题。
Module not found: Can't resolve 'three/examples/jsm/modifiers/CurveModifier' in '/Users/....'
导入语句:
import { Html } from "@react-three/drei";
package.json 文件的一部分
"dependencies": {
"@react-three/drei": "2.2.18",
"axios": "0.19.2",
"chroma-js": "2.1.0",
"next": "9.5.0",
"next-redux-wrapper": "6.0.2",
"prop-types": "15.7.2",
"ramda": "0.27.0",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-redux": "7.2.1",
"react-three-fiber": "4.2.18",
"redux": "4.0.5",
"redux-devtools-extension": "2.13.8",
"redux-saga": "1.1.3",
"three": "0.119.0"
}
CurveModifier 是一项新的三项功能。要么更新 threejs,要么做 import { Html } from "@react-three/drei/Html";