Babylon JS NullEngine not a constructor

Viewed 396

Using Babylon 4.2

import * as BABYLON from 'babylonjs';
var engine = new BABYLON.NullEngine();
var scene = new BABYLON.Scene(engine);

Yields

TypeError: BABYLON.NullEngine is not a constructor

In Babylon 4.2. However, the documentation uses this syntax : https://doc.babylonjs.com/typedoc/classes/babylon.nullengine

1 Answers

Try changing

import * as BABYLON from 'babylonjs';

to

import BABYLON from 'babylonjs';

Worked for me, when writing with Node.js v16

Related