小编Ale*_*lex的帖子

在 next.js 中加载 GLTF 模型/错误:无法加载 <url> response.body.getReader 不是函数

如何在 next.js 中加载模型 GLTF 模型?

我花了几个小时寻找这个。没有任何效果:(


到目前为止我尝试过的:

  • 使用不同的加载器(useLoader(GLTFLoader,url) / useGLTF(url) and some more
  • 将组件包装在next/dynamic组件中/不这样做
  • suspense通过使用 React 18 安装 next 来解决与不支持相关的错误
  • 尝试了这个入门模板
  • 使用three-stdlib
  • 尝试编写自定义加载程序next.config.js

阅读我能找到的关于该问题的每个问题和论坛帖子


我目前得到的错误是:

Server Error
Error: Could not load  <url> response.body.getReader is not a function
Run Code Online (Sandbox Code Playgroud)

组件如下所示:

import React from 'react'
import { useGLTF } from '@react-three/drei'
import { Canvas, } from '@react-three/fiber'
import { Suspense } from 'react/cjs/react.production.min';

export default function Spinner({ ...props }) {
  const model = useGLTF("http://localhost:3000/spinner.glb")
  return ( …
Run Code Online (Sandbox Code Playgroud)

webgl three.js reactjs next.js react-three-fiber

3
推荐指数
1
解决办法
4747
查看次数

标签 统计

next.js ×1

react-three-fiber ×1

reactjs ×1

three.js ×1

webgl ×1