# TerrainMaterial not a construtor using webpack

**URL:** <https://forum.babylonjs.com/t/terrainmaterial-not-a-construtor-using-webpack/5533>\
**Category:** Questions\
**Created:** [September 8, 2019, 6:06pm UTC](https://forum.babylonjs.com/t/terrainmaterial-not-a-construtor-using-webpack/5533 "2019-09-08T18:06:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pab144](https://avatars.discourse-cdn.com/v4/letter/p/a8b319/32.png) [@Pab144](https://forum.babylonjs.com/u/Pab144)\
**Post date:** [September 8, 2019, 6:06pm UTC](https://forum.babylonjs.com/t/terrainmaterial-not-a-construtor-using-webpack/5533/1 "2019-09-08T18:06:41Z")

</div>

Hi guys,

I have strange issue with a small project I’m working on. I’m using webpack to bundle up my code when I try to run my build on the browser I get this error:

babylonjs\_\_WEBPACK\_IMPORTED\_MODULE\_0\_\_.TerrainMaterial is not a constructor

I installed the babylonjs-materials package from npm and I’m importing it in my file, however the error persists. Any ideas as to what could be causing this issue? I’m fairly new to webpack it’s possible I’m doing something wrong there but any help would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![Pab144](https://avatars.discourse-cdn.com/v4/letter/p/a8b319/32.png) [@Pab144](https://forum.babylonjs.com/u/Pab144)\
**Post date:** [September 8, 2019, 10:27pm UTC](https://forum.babylonjs.com/t/terrainmaterial-not-a-construtor-using-webpack/5533/2 "2019-09-08T22:27:27Z")

</div>

Okay after some digging through Babylon’s NPM docs I learned that the proper way to import the babylon-materials packapge is using:

```auto
import * as Materials from 'babylonjs-materials';

```

and not

```auto
import 'babylonjs-materials';

```

as the NPM site suggests, I’m not sure why it this does not extend the BABYLON namespace, but either way the docs say otherwise.

links for verification:

> **[babylonjs-materials](https://www.npmjs.com/package/babylonjs-materials)**
>
> The Babylon.js materials library is a collection of advanced materials to be used in a Babylon.js scene.

  
[https://doc.babylonjs.com/features/npm\_support#installing-other-babylon-modules](https://doc.babylonjs.com/features/npm_support#installing-other-babylon-modules)

I think the info in the NPM site should be fixed as the BABYLON docs are very specific that when using es6 modules you have to set your own namespace.

I hope this helps others, happy hacking!
