BabylonJS / Extensions

Extensions for Babylon.js
177 stars 157 forks source link

Generate a d.ts file for MeshWriter / publish package to NPM #153

Closed JulienNoble closed 4 years ago

JulienNoble commented 5 years ago

I think this will be relevant to @briantbutton and your awesome work on the MeshWriter. I'm currently working on a heavy typescript project using the npm version of babylon and webpack for building. Everything is going smooth, but I would like to integrate the mesh writer directly into the ts code to use autocomplete and type checking (and project coherency altogether, I want to allow as few js as possible in the unbuilt sources). I'm currently using it as a straight JS file, but for one it doesn't seem to care about it (namespace extension doesn't work, webpack doesn't want to load it, even with resolved js files) and I get a ton of wriggly lines in editor because it doesn't get where this code is coming from. I tried porting the original javascript source to pure ts, but man do I not get how AMD defines work.

I'd honestly be okay with just a declaration file that I can bring in alongside the js file for local import, like a quick and dirty any on all types, but I'd really love an NPM package to add and import like babylon-loaders and similar extensions.

What do you think? Is it something complicated to do? I'm ready to help if needed, but I'm going to need a crash course to understand your font definition logic :)

briantbutton commented 5 years ago

Julien, I understand, broadly, where you want to go. I am a big supporter of having a homogeneous code base.. Furthermore it is healthy for me to do more Typescript.

Request for clarification: You made a couple comments inside parentheses, starting with "namespace". Could you fill that out? It sounds like WebPack does some enforcement of some sort that makes it hard for MeshWriter.

Let me noodle your request. I particularly need to get with DeltaKosh to understand the environment for and requirements for tighter integration. Note: I am familiar with a side declaration file, as an approach, too.

In the meantime, can you limp by?