How to install MeshWriter with npm

How to install MeshWriter with npm ?

NineCurrent, right now it is not an npm package. Sorry.

If your timeframe is more than a couple weeks I would be happy to set that up. I have thought about it before but I guess I needed a request to galvanize me.

Would that be valuable?

1 Like

I can wait for any week and that would be really helpful.
I am very happy to galvanize you to do this. :smile:

1 Like

NineCurrent, it is now available.

This is the first time I have done this, so please feel free to suggest improvements.

1 Like


Hey everyone, meshwriter-1.0.3 on NPM, did not work for me. Sorry for any inconvenience.

meshwriter-1.1.0 on NPM seems fine. Sorry for the inconvenience. Still learning.

1 Like

Hey @TheLeftover thank you very much I will try it this week.

I try it but I don’t no how to import.
I try import with "import ‘meshwriter’ " and "import * as MeshWriter from ‘meshwriter’ " but it doesn’t work
I use webpack
Error : Uncaught TypeError: babylonjs__WEBPACK_IMPORTED_MODULE_0__.MeshWriter is not a function


Can you tell me a little bit more about your setup?

For most browser applications, I don’t recommend using the whole NPM setup. You only need one file. If you use the NPM install, it is ‘node_modules/meshwriter/dist/meshwriter.min.js’. You may find it easier just to grab the same file from “”. That is the reference that all the playgrounds use. I commit to keeping those up to date and current with each other. The same file, BTW, is also in my meshwriter github repository. GitHub - briantbutton/meshwriter: Babylon Mesh Writer

That file, meshwriter.min.js, should be able to be imported using ‘import’, a direct link in the html code or other normal methods. If it isn’t, please give me details of your setup.

This is a good time to remind you that you need ‘earcut’ too. Easy peasy. See the documentation under my github repo. The earcut file is there too, if you need it.

npm i meshwriter

and add earcut inindex.html

<script src=""></script>

Then you can use it like

import * as MeshWriter from "meshwriter";

 let Writer = new MeshWriter(scene, { scale: 0.1, defaultFont: "Arial" });
        let text1 = new Writer(
            "Blah Blah",
                "anchor": "center",
                "letter-height": 100,
                "color": "#1C3870",
                "position": {
                     "x": 0,
1 Like

As of today, a new version (1.2.3) is out that incorporates Earcut. So that should no longer be required.

1 Like

I have problem integrating MeshWriter into Angular typescript project. I am doing it like @HiteshSahu, but i got following error:

BABYLON.StandardMaterial is not a constructor
at c (meshwriter.min.js:7)
at new MeshWriter (meshwriter.min.js:7)

I don’t have BABYLON namespace at all.