UNcaught TypeError: BABYLON.MeshBuilder.createBox is not a constructor at createScene

When I do write MeshBuilder, it throws me an error saying
Uncaught TypeError: BABYLON.MeshBuilder.createBox is not a constructor
at createScene

Here’s the code I wrote:


const canvas = document.getElementById(‘renderCanvas’);

// create engine

const engine = new BABYLON.Engine(canvas, true);
function createScene(){

const scene = new BABYLON.Scene(engine);

//create camera

const camera = new BABYLON.FreeCamera('camera', new BABYLON.Vector3(0, 0, 0), scene);

//create light

const light = new BABYLON.HemisphericLight('light', new BABYLON.Vector3(0, 1, 0), scene);

//create a box

const box = new BABYLON.MeshBuilder.createBox('box',{}, scene);

return scene;

}
const scene = createScene();

engine.runRenderLoop(() => {

scene.render();

});

Can someone help me what am I doing wrong here.

This got resolved without any change. For some reason my editor wasn’t working properly and it didn’t recognised it.