Unable to load DynamicTerrain extension as a module

I’m new to Babylonjs. A little frustrated by my inability to include the DynamicTerrain extension as a module in my app.ts file. I downloaded the js file locally and include the following statement in app.ts … What am I missing here?

let DynamicTerrain = require(’…/public/js/DynamicTerrain.min.js’);

gives error:

bundleName.js:12175 Uncaught TypeError: Cannot read properties of undefined (reading ‘Zero’)

Thanks in advance.

The DynamicTerrain module (written by @jerome ) requires the BABYLON global namespace.

define window.BABYLON = YourBabylonImport and it should work as expected.

1 Like