GLTFLoader - 404 not found


I’ve got problems with gltf loader. I have a problems with loading local glb file. I’m using angular.
I am using this sample code:

import * as THREE from 'three';
import GLTFLoader from 'three-gltf-loader';
const loader = new GLTFLoader();
    ( gltf ) => {
        // called when the resource is loaded
        scene.add( gltf.scene );
    ( xhr ) => {
        // called while loading is progressing
        console.log( `${( xhr.loaded / * 100 )}% loaded` );
    ( error ) => {
        // called when loading has errors
        console.error( 'An error happened', error );

when I use path like

It is working without any problems.
But when I download this file and put it into /src/Flamingo.glb then I use url like: ‘http://localhost:4200/flamingo.glb’ or './Flamingo.glb it doesn’t work.
In console there is an error: GET http://localhost:4200/flamingo.glb 404 (Not Found)
I have no idea what could be wrong

Thanks in advance

1 Like

I found solution. Maybe someone will have similar problem.
I put my file into assets folder and then use url :’…/…/assets/flamingo.glb’

Please do not use three-gltf-loader. Always import the loader and other examples files from the three package like so:

import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';