Can't import gltf model

Hey,
I have an issue, when trying to load a gltf model it throws this error. The confusing part for me is that if I use the CDN for Babylon js it works. So I don’t know what I’m doing wrong on my end.

Also I’ve updated the package to the latest version.

Screenshot_20

Any help is appreciated!

It seems you miss to import the loaders package: @babylonjs/loaders (es6) or babylonjs.loaders.js (UMD).

1 Like

Well, I’m using the asset manager to load them in, so I don’t know exactly what I should import form the loaders file.

But yes, I already have the loaders package installed.

That’s what I meant in my answer. Are the versions of the Babylon packages you are using all the same? I think it will help if you can repro the problem somewhere and give us access.

Never mind me, indeed you were right. It’s a bit weird though, because now I don’t understand why it worked before.

I’ve added the import "babylonjs-loaders" line to the code and it works perfectly. So I was clearly missing that, but I didn’t need to use it before. I was just importing the classes from the babylonjs package like import { AssetsManager, MeshAssetTask } from "babylonjs" etc.

Anyways, thanks for the help!

1 Like