How to develop in examples/jsm (ES6 vs ES5)

Hi, this is not clear for me in the file. Looks like we should always do it in js.

Last time I contributed I worked on the examples/jsm folder. However, some repo owners told me to also do it on examples/js or my code would be gone when running the procedure to create the module version.

It’s weird to write ES5 code to generate ES6. I just wonder how we can do that directly with ES6 in the jsm. Or for some reason this is not recommended?


1 Like

Right now, you have to update examples/js and then generate the ES6 module code with node utils/modularize.js.

We know this workflow is far from ideal but as soon as import maps become more common this will be changed.


Ok, I understand it.

Another question in this regard: If this is only to build ES6 modules meanwhile, Can we use things like const or let in examples/js, for instance?

No because this code still needs to run in older browsers.

Thanks @Mugen87.

Final question, We must provide the declaration file (filename.d.ts), right?

Yes, that’s correct.

1 Like