add examples/jsm, examples/js folders to CDN and change three.js CDN path
See original GitHub issueWould it be a good idea to add the examples/jsm and examples/js folders to the CDN?
There’s a few reasons this seems like it would be a good idea
-
The offical instructions say you should always use the correct version of an example (like OrbitControls) but 1000s and 1000s of snippets/codepens/jsfiddles etc link directly to https://threejs.org/examples/js/controls/OrbitControls.js. Of course putting the example js files on the CDN won’t make devs do it correctly but it will at least give them a simple option
-
If three.js’s CDN path changed from
https://cdnjs.cloudflare.com/ajax/libs/three.js/109/three.module.js
to
https://cdnjs.cloudflare.com/ajax/libs/three.js/109/build/three.module.js
and the examples jsm files were at
https://cdnjs.cloudflare.com/ajax/libs/three.js/109/examples/jsm/...
Then users could use three and all the supporting example helpers like GLTFLoader, EffectComposer, etc via ES6 modules.
As it is
three.module.js
is on a CDN but AFAICT there isn’t much point to that since you can’t use any of the modules as internally they all have paths of the formimport {x} from '../../../build/three.module.js'
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top GitHub Comments
^But yeah to be clear, Cloudflare’s CDNJS project is not maintained by us; we can only make suggestions or pull requests for what they include.
Looks like they’re managed here, with some automation:
https://github.com/cdnjs/cdnjs/tree/master/ajax/libs/three.js
Don’t know whether replicating
examples/js/*
andexamples/jsm/*
would be something the cdnjs maintainers want or not. 🤔