gpt4 book ai didi

reactjs - 在 React(ThreeJS) 中使用 GLTFLoader 时应定义优化信息的 Vite 错误

转载 作者:行者123 更新时间:2023-12-05 01:04:15 25 4
gpt4 key购买 nike

我使用 vite 构建了一个 react 环境。当我从模块导入 GLTFLoader 时,vite 命令行提到:

Vite Error, /node_modules/.vite/deps/three_examples_jsm_loaders_GLTFLoader.js?v=9d4ee121 optimized info should be defined

这是我的代码:

import * as Three from "three"
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader'

[...]

const gltfLoader = new GLTFLoader()
gltfLoader.setPath('public/')

gltfLoader.load('000.hdr', gltf => {
gltf.scene.scale.set(0.2,0.2,0.2)
scenes.add(gltf.scene)
})

这是错误消息: enter image description here

最佳答案

对于 future 的其他人,YMMV:删除 node_modules 和 pnpm-lock.yaml 解决了这个问题。

关于reactjs - 在 React(ThreeJS) 中使用 GLTFLoader 时应定义优化信息的 Vite 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72455626/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com