Including Ammo.js with BABYLON using Nodejs

So I am trying to get Ammo.js to work with BABYLON inside NodeJS using import statements, I have already installed babylonjs and ammo.js using npm, although I don’t know how to use import/require statements to get Babylon to register that Ammojs is there, here is the small example I have right now:

import * as BABYLON from 'babylonjs';
var canvas = document.getElementById("renderCanvas");
var engine = new BABYLON.Engine(canvas, true, { preserveDrawingBuffer: true, stencil: true });

var scene = new BABYLON.Scene(engine);
scene.enablePhysics(new BABYLON.Vector3(20,0,0),new BABYLON.AmmoJSPlugin())
var camera = new BABYLON.FreeCamera("camera1", new BABYLON.Vector3(0, 5, -10), scene);
camera.setTarget(BABYLON.Vector3.Zero());
camera.attachControl(canvas, true);
var light = new BABYLON.HemisphericLight("light", new BABYLON.Vector3(0, 1, 0), scene);
light.intensity = 0.7;
var sphere = BABYLON.MeshBuilder.CreateSphere("sphere", {diameter: 2, segments: 32}, scene);
new BABYLON.PhysicsImpostor(sphere,BABYLON.PhysicsImpostor.MeshImpostor,{ mass: 1, friction: 1.0, restitution: 0 },scene)
sphere.position.y = 1;
var ground = BABYLON.MeshBuilder.CreateGround("ground", {width: 6, height: 6}, scene);

engine.runRenderLoop(function () {
	if (scene) {
		scene.render();
	}
});

But when I build it using webpack and then run the index.html I get the error “Uncaught ReferenceError: Ammo is not defined”

Good news everyone, I have figured out the answer, even though I’m pretty sure no one will ever need this information the problem was that the ammo.js npm module is missing like half of the api for some reason (fantastic!) but after instead doing npm install kripken/ammo.js it installed the complete version and then after modifying the code because I realized i need to pass the import to the plugin in worked great.

import * as BABYLON from 'babylonjs';
import * as Ammo from 'ammo.js';

var canvas = document.getElementById("renderCanvas");
var engine = new BABYLON.Engine(canvas, true, { preserveDrawingBuffer: true, stencil: true });

var scene = new BABYLON.Scene(engine);
scene.enablePhysics(new BABYLON.Vector3(20,0,0),new BABYLON.AmmoJSPlugin(true,Ammo))
var camera = new BABYLON.FreeCamera("camera1", new BABYLON.Vector3(0, 5, -10), scene);
camera.setTarget(BABYLON.Vector3.Zero());
camera.attachControl(canvas, true);
var light = new BABYLON.HemisphericLight("light", new BABYLON.Vector3(0, 1, 0), scene);
light.intensity = 0.7;
var sphere = BABYLON.MeshBuilder.CreateSphere("sphere", {diameter: 2, segments: 32}, scene);
new BABYLON.PhysicsImpostor(sphere,BABYLON.PhysicsImpostor.MeshImpostor,{ mass: 1, friction: 1.0, restitution: 0 },scene)
sphere.position.y = 1;
var ground = BABYLON.MeshBuilder.CreateGround("ground", {width: 6, height: 6}, scene);

engine.runRenderLoop(function () {
	if (scene) {
		scene.render();
	}
});

Congrats!