-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Modules with EXPORT_ES6=1 do not work in NodeJS #15022
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
Does node not define both |
Ran into the same issue as well. In cases where NodeJS is running in ES Module mode (as opposed to CommonJS mode), I'm not sure what command-line flag may be used to force Node to run in ES Module mode, though including To take into account NodeJS running in ES Module mode, it may be better to have the check be: if (!(typeof process === "object" && (!require || typeof require === "function"))) EDIT: Another problem in the case NodeJS is ran with ES Modules support is that all imports need to be made at the top of the JS file too. |
cc @RReverser |
I've got a fix in flight |
The check for `require` was being applied even in the case that it wasn't needed. The check for node, when running under the shell environment was out of date with the node check that we use to define ENVIRONMENT_IS_NODE and should not have been checking for require (which is not always present under node these days). Fixes: #15022
The check for `require` was being applied even in the case that it wasn't needed. The check for node, when running under the shell environment was out of date with the node check that we use to define ENVIRONMENT_IS_NODE and should not have been checking for require (which is not always present under node these days). Fixes: #15022
I think this is a duplicate of #11792. There are a lot of checks / issues necessary for EXPORT_ES6 + Node.js to work. |
The check for `require` was being applied even in the case that it wasn't needed. The check for node, when running under the shell environment was out of date with the node check that we use to define ENVIRONMENT_IS_NODE and should not have been checking for require (which is not always present under node these days). Fixes: #15022
I'll close this issue in favour of #11792. |
Hi team,
Emscripten will throw an error when attempting to instantiate modules build with EXPORT_ES6=1:
My Makefile configuration:
I'm happy to take a look if someone can point me in the right direction. Many thanks!
The text was updated successfully, but these errors were encountered: