collada.js icon indicating copy to clipboard operation
collada.js copied to clipboard

Could you publish this as a package on NPM?

Open TheKnarf opened this issue 6 years ago • 3 comments

Publishing it as a package on NPM would make it easier for others to reuse the library in their own projects.

TheKnarf avatar Mar 13 '19 08:03 TheKnarf

I do not use NPM so I dont know if this JS will work as a module. But if you tested and it works then I can try to upload it to npm

jagenjo avatar Mar 13 '19 08:03 jagenjo

Theres a few structural changes to the code I would make. You're setting the global.Collada variable instead of using export to export the code so that other modules could reuse it, it's better to let the users of the library decide how they want to use the code instead of setting global variabels that might not work correctly in all environments (this might work fine in the browser, but would not work with Node.js, and would work poorly with packaging tools like Webpack and Browserify).

Edit: This article talks a bit about how JavaScript modules works.

TheKnarf avatar Mar 13 '19 09:03 TheKnarf

I just uploaded a version that supports modules, now you can import the module and take the Collada property. But remember that this only works in the browser, so I cannot make a npm package as people will expect it to work in node.

jagenjo avatar Mar 13 '19 10:03 jagenjo