Why do I get the error - Uncaught TypeError: THREE.FBXLoader is not a constructor?

in my code, for some reason, an error occurs with the fbx format loader on the site
, the code should upload a model with its animation to the fbx site
here is the html code (here is only the necessary part related to scripts):


<script type="importmap">
    {
      "imports": {
        "three": "../build/three.module.js",
        "three/addons/": "./jsm/"
      }
    }
    </script>
  <script type="module" src="script/script.js"></script>

js

import * as THREE from 'https://cdn.jsdelivr.net/npm/three@0.132.2/build/three.min.js';

import { Stats } from 'https://unpkg.com/es-module-shims@1.6.3/dist/es-module-shims.js';
import {  GLTFLoader  }  from 'https://unpkg.com/three@0.126.0/examples/js/loaders/GLTFLoader.js';

      THREE.ColorManagement = true;
      let camera, scene, renderer, stats;
      const clock = new THREE.Clock();
      let mixer;
      init();
      animate();
      function init() {
        const container = document.createElement( 'div' );
        document.body.appendChild( container );

        camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 2000 );
        camera.position.set( 100, 200, 300 );

        scene = new THREE.Scene();
        scene.background = new THREE.Color( 0xa0a0a0 );
        scene.fog = new THREE.Fog( 0xa0a0a0, 200, 1000 );

        const hemiLight = new THREE.HemisphereLight( 0xffffff, 0x444444, 1.5 );
        hemiLight.position.set( 0, 200, 0 );
        scene.add( hemiLight );

        // model
        const loader = new GLTFLoader ();
        loader.load( '3dmoddel/Flair.fbx', function ( gltf) {
	model = gltf.scene;
          mixer = new THREE.AnimationMixer( gltf);

          const action = mixer.clipAction( gltf.animations );
          action.play();

          object.traverse( function ( child ) {

            if ( child.isMesh ) {

              child.castShadow = true;
              child.receiveShadow = true;

            }

          } );

          scene.add( model);

        } );

        renderer = new THREE.WebGLRenderer( { antialias: true } );
        renderer.setPixelRatio( window.devicePixelRatio );
        renderer.setSize( window.innerWidth, window.innerHeight );
        renderer.outputEncoding = THREE.sRGBEncoding;
        renderer.shadowMap.enabled = true;
        container.appendChild( renderer.domElement );

        window.addEventListener( 'resize', onWindowResize );

        stats = new Stats();
        container.appendChild( stats.dom );

      }
      function animate() {

        requestAnimationFrame( animate );

        const delta = clock.getDelta();

        if ( mixer ) mixer.update( delta );

        renderer.render( scene, camera );
s
        stats.update();

      }
      function openForm() {
      document.getElementById("myForm").style.display = "block";
      }

      function closeForm() {
      document.getElementById("myForm").style.display = "none";
      }

You aren’t showing how you’re loading/importing the FBXLoader, neither actually calling THREE.FBXLoader but FBXLoader. Also please fix the formatting.

I added the import as you said, but in the end he can’t find these files, writes a 404 error and changed FBXLoader to THREE.FBXLoader

I changed the import a bit, everything started working for me, except gltfloader (I changed it from fbx to gltf)
error: Uncaught SyntaxError: The requested module ‘https://unpkg.com/three@0.126.0/examples/js/loaders/GLTFLoader.js’ does not provide an export named ‘GLTFLoader’ (at script.js:4:11)

Just curious: have you tried to load it from examples/jsm/loaders/ instead of examples/js/loaders/?

yes, but it throws a 404 error

sorry I made a syntax error, but now there is an error with stats because he can’t find it

import { Stats } from 'https://unpkg.com/es-module-shims@1.6.3/dist/es-module-shims.js';

Maybe it is because you load Stats from es-module-shims.js?!? This is not the correct file for Stats.

const loader = new GLTFLoader ();
    loader.load( '3dmoddel/Flair.fbx', function ( gltf) {
model = gltf.scene;

…}

I think the problem could from the file extension .fbx cannot be read by GLTFLoader. As I know, GLTFLoader can load files with .gltf and .glb format. About your URL, I checked in the unpkg and it’s correct. You should try using FBXLoader instead of GLTFLoader.