Unable to import babylonjs-materials

Hi guys, seems I’m unable to import and use babylonjs-materials. I’m trying to use NormalMaterial. The bundler I’m using is parceljs, not sure if there is an issue there. Here’s a codesandbox link depicting the issue - amazing-austin-jj241 - CodeSandbox

The error I’m getting is -
BABYLON.NormalMaterial is not a constructor

Thanks for taking out your time.

Pinging @RaananW or @sebavan

You should import the material from it : rough-sea-59soh - CodeSandbox

Also would be great to not use BABYLON as a variable as it as a special meaning in the bundle.

Just wanted to add to the (IMO) correct answer @sebavan gave you, if you do want to use the BABYLON namespace, and only when using the UMD packages, you can avoid importing * as BABYLON and simply use the global BABYLON namespace:

fast-cookies-feekh - CodeSandbox

It’s not clean, but I believe this is the source of the confusion.

1 Like