-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Recognize .mjs
the same as .js
#7853
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
Comments
Should be an easy fix.. |
Sounds reasonable to support it optionally. I'm less sure we should emit it with |
To load an ES6 module in Node, an I’d prefer to automatically output cc @mathiasbynens to keep me honest. |
@surma nailed it:
|
Thanks, makes sense. Ok, sgtm to emit |
Asking for a file of this extension enables EXPORT_ES6 and MODULARIZE. Fixes #7853
* Allow .mjs for js module output Asking for a file of this extension enables EXPORT_ES6 and MODULARIZE. Fixes #7853
Should the output then work as a ES Module in Node? I'm getting an error when I try that. I compiled the sample shown at https://v8.dev/features/wasm-bigint using: I then started Node 14.15 using
|
Ran into that recently myself @dasa . I think the ES modules are meant to not contain Node-specific features like __dirname. The trick to get it to work apparently is: import path from 'path'
const __dirname = path.dirname(new URL(import.meta.url).pathname) |
Looks like something we should fix. Would you mind opening a separate issue specifically about |
Already raised: #11792 |
.mjs
is the file extension that is used for ES6 modules.Emscripten should probably output an
.mjs
file when-s EXPORT_ES6=1
is set.//edit: Emscripten currently outputs LLVM IR code when specifying
-o file.mjs
.The text was updated successfully, but these errors were encountered: