How to import babylon.js in js code file?

I’m just starting to learn js and immediately decided to do babylon, downloaded via npm, but how to import it? I looked at the documentation, I also do nothing, it says in the browser console that “Uncaught SyntaxError: Cannot use import statement outside a module (at script.js:1:1)”. This is how I do it: import * as BABYLON from “babylonjs/babylon.js”. I write in vs code.

Hi @kalashnikovjan123 and welcome to the forum

import is Typescript. To load babylon.js from a .html :

Or, easier, you can use this template to use babylon.js with typescript:

It’s really easy to use.

1 Like

Maybe this doc page will help?