Uncaught SyntaxError: import declarations may only appear at top level of a module

Hello, im trying to import a 3d file from blender with GLTFLoader. And i get the errors: Uncaught SyntaxError: import declarations may only appear at top level of a module and
Uncaught TypeError: THREE.GLTFLoader is not a constructor.
does anyone have any tips on how to solve this? Thank you

What version of three are you using? GLTFLoader is now part of addons and needs to be imported without the THREE name space like in this example. Your first error means you’re trying to use the import statement within a function or conditional statement, you’ll need to put all of your imports at the top of the js file before anything else