Problems with import SceneLoader

Hi , I’m working on very intersting project right now, and one of the interestion thing of it very tight requirements to size. I have met a problem with SceneLoader
if I import it like this
import {SceneLoader} from “@babylonjs/core/Loading/sceneLoader”

and run

 return new Promise(async(resolve)=>{
      loader();
        function loader(){
          let name = models.shift()
          console.log(SceneLoader);
          SceneLoader.ImportMeshAsync('','',
          `models/${name}.glb`,
          scene
          ).then((result) => {
            if(!name)return
            const root = result.meshes[0]
            root.name = name;
            if(models.length==0){
              resolve(true)
            }else{
              loader();
            }
        })
      }
    })

it is failed with error

Uncaught (in promise) RuntimeError: Unable to load from models/walk-x-bot.glb: importMesh of undefined from undefined version: undefined, exporter version: undefinedimportMesh has failed JSON parse

However all work well if I import this one
import “@babylonjs/loaders”;
but if sceneLoader size is 439kb when babylonjs/loaders is 1.4 Mb which is too much for my project

"@babylonjs/loaders/glTF/glTFFileLoader.js"
If you only need to load the gltf model, see if the dependencies will be smaller.

2 Likes

yep it is 734kb thanx)

but now I have new error Unable to load from models/walk-x-bot.glb: Unsupported version: 2.0

I have found I need this one @babylonjs/loaders/glTF/2.0/glTFLoader

1 Like