gkjohnson / urdf-loaders

URDF Loaders for Unity and THREE.js with example ATHLETE URDF Files open sourced from NASA JPL
https://gkjohnson.github.io/urdf-loaders/javascript/example/bundle/index.html
Apache License 2.0
469 stars 121 forks source link

Not working in Next js 14.2.3 #289

Closed Ash786Sharma closed 5 months ago

Ash786Sharma commented 5 months ago
useEffect(() => {
  const loadRobot = async () => {
    useLoader(URDFLoader, filepath, (loader) => {
      loader.loadMeshCb = (path, manager, done) => {
        new STLLoader(manager).load(
          path,
          (result) => {
            console.log(result);
          },
          null,
          (err) => done(null, err)
        );
      };
      loader.fetchOptions = {
        headers: { Accept: "application/vnd.github.v3.raw" }
      };
    });
  };

  loadRobot().catch(console.error);
}, []);

I have tried SSR & Client side but it not work with both approch. with SSR it gives DOM / Document error as we know that DOM / Document is not available on server & with Client side it always showes TypeError: Cannot add property loadMeshCb, object is not extensible

gkjohnson commented 5 months ago

This sounds / looks like a bundler or API issue with Next JS or react three fiber or typescript. Unless you can point to something specific in this project that's causing an issue I don't think there's anything that can be done.