xeolabs / xeogl

A WebGL-based 3D engine for technical visualization. Not actively maintained.
http://xeogl.org
Other
1.15k stars 264 forks source link

Packaging / es6 module usage #249

Open salfield opened 6 years ago

salfield commented 6 years ago
Description of the problem

I'm trying to use xeogl in an ES6 app using the ES6 module system. xeogl is written in ES5 and constructed as a global. This is fine as I can install it from github using a package manager and import the exported xeogl global.

The problem is that the examples files are not exported. They need to be loaded and then they modify the xeogl global. I don't want to include these files as script tags at the top of my page and ideally wouldn't need to build a custom way of loading them.

I'm not sure how (or if) it is possible to import these into an es6 app. In any case the practice of adding features to the xeogl global feels limiting.

When using these examples I've ended up downloading the source files and modifying them to export there functionality rather than adding it to the xeogl global. This means I'm unnecessarily copying and modifying. I'd like to be in sync with any changes made to these example files and to offer back changes in the form of pull requests. At present this feels infeasible.

Not sure what the best solution is here, but I'd advocate either: a) turning these examples gradually into separately packaged modules which can be installed and imported (without modifying the global).

OR b) exporting them as separate exports from the global namespace.

Happy to do the work to make this happen, if it is helpful.

xeogl version
Browser
OS
Hardware Requirements
Navya-adft commented 4 years ago

i also face this issue, anyone is able to help is appreciated