grame-cncm / guidolib

Guido project - music score layout engine - music description language
http://guido.grame.fr
Mozilla Public License 2.0
152 stars 34 forks source link

Javascript build is missing a ES6 output option. #182

Open jonhallur opened 4 months ago

jonhallur commented 4 months ago

To be compatible with modern web framework.

dfober commented 4 months ago

There is a new 'es6' target in the lang/javascript Makefile (dev branch). Not tested. I'm just wondering if the wasm file is affected and how it's compatible with both targets (js, mjs).

jonhallur commented 3 months ago

From the Emscripten docs.

EXPORT_ES6 Export using an ES6 Module export rather than a UMD export. MODULARIZE must be enabled for ES6 exports and is implicitly enabled if not already set. This is implicitly enabled if the output suffix is set to ‘mjs’.

I just changed the Makefile on line 65 to include EXPORT_ES6=1 so I could use it. AFAIK the only change in the JS is that it is wrapped in a promise function, where you can give the module some setting and has an export default for the file.

dfober commented 3 months ago

Thanks for the info. Actually I used the implicit method i.e. the mjs suffix