Import mesh with sync function

Does it possible import meshes from a sync function?
It’s very tedious to use ImportMesh as async.
I don’t know how to load the mesh without make some ungly code like this:

SceneLoader.ImportMesh(...params, (meshes) => {
   SceneLoader.ImportMesh(...params, (meshes) => {
     SceneLoader.ImportMesh(...params, (meshes) => {
      // here we can finnish in the hell of assembly.

I’ve tried with encapulating the loaders in a function, and use “await funcLoad()”, but the tsc give me some messages to use another version of target (es2017).

So, there’s some method to make sync load or can you give some “correct” way to do load?
NOTE: Yes, I read the dosc, but it not helps with kind of situation, because for some parts of the dosc, all meshes are in one babylon file, and I have one mesh per babylon file.

async / await should work:


In this tsconfig.json async / await worked.


    "compilerOptions": {
      "sourceMap": true,
      "target": "es5",
      "module": "es2015",
      "strict": true,
      "noUnusedLocals": true,
      "noUnusedParameters": true,
      "noImplicitReturns": true,
      "types": ["babylonjs", "babylonjs-loaders"],
      "lib": ["es2015", "dom"],

Man, thank you for the example! This solved the problem and some others.

Thank you for the config, I was using some config like that, but I will use some more options from yours.