Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[idea] Switch to a module system instead of a global namespace, then use the module system to optionally construct a global namespace. #7070

Closed
trusktr opened this issue Aug 28, 2015 · 1 comment

Comments

@trusktr
Copy link
Contributor

trusktr commented Aug 28, 2015

For example, use CommonJS or ES6 modules for all things. This will help to convert to a properly modular library for NPM.

The advantage of this is that people will be able to require/import certain classes into their projects, and their build tools will compile only those classes, not the entire library, making application more lean.

The user can optionally use THREE as a contain-all by importing three. That would load the project's index.js file, and that file would use CommonJS or ES6 import syntax to load all the other files it needs, and it would export a single object equivalent of what THREE currently is.

Users would also be able to import, say, three/core/Object3D as in

import Object3D from `three/core/Object3D`

or

let Object3D = require('three/core/Object3D')

to import classes directly, and when their program is compiled, only the things they use will be built into their applications.

ES6 modules are an official part of JavaScript now, so it would be super beneficial to convert to those, use semver, and to publish on NPM.

@GGAlanSmithee
Copy link
Contributor

There is a long standing issue about this already - #4776

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants