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

Javascript build is missing a ES6 output option. #182

Open
jonhallur opened this issue Mar 18, 2024 · 3 comments
Open

Javascript build is missing a ES6 output option. #182

jonhallur opened this issue Mar 18, 2024 · 3 comments

Comments

@jonhallur
Copy link

To be compatible with modern web framework.

@dfober
Copy link
Member

dfober commented Mar 20, 2024

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
Copy link
Author

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
Copy link
Member

dfober commented Mar 26, 2024

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

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

No branches or pull requests

2 participants