显示'Module not found'错误的三个.js三个节点



./node_modules/three/examples/jsm/renderers/webgpu/nodes/WebGPUNodeBuilder.js找不到模块:无法解析"three-nodes/core/CodeNode.js"。我正在使用react,import three from node_modules,它抛出这样的错误。

我能做些什么来解决它?

为什么"三个节点/":&"/jsm/nodes/"?

我认为这个GitHub问题是相关的:https://github.com/mrdoob/three.js/issues/24377

three-nodesthree/examples/jsm/nodes的别名,因此,如果您有此问题,您需要让您的程序识别此别名。你可以从这个回复中在Vite中找到方法,或者从下面的配置(支持@rollup/plugin-alias(中找到方法

{
...,
plugins: [
...,
alias({
entries: [
{ find: 'three-nodes', replacement: 'three/examples/jsm/nodes' }
]
})
]
}

最新更新