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

MODULARIZE=1 adds code incompatible with MIN_NODE_VERSION=101900 #21917

Open
mzoliker opened this issue May 9, 2024 · 2 comments
Open

MODULARIZE=1 adds code incompatible with MIN_NODE_VERSION=101900 #21917

mzoliker opened this issue May 9, 2024 · 2 comments

Comments

@mzoliker
Copy link

mzoliker commented May 9, 2024

Hi! Using emscripten v3.1.59, here are the two lines at the very beginning that should be fixed:

  var _scriptName = typeof document != 'undefined' ? document.currentScript?.src : undefined;
  if (typeof __filename != 'undefined') _scriptName ||= __filename;

The optional chaining operator (?.) and the logical OR assignment (||=) are only available in newer versions of NodeJS.
Those two lines are added by -sMODULARIZE=1.
Thanks a lot for the fix!
Kind regards,
Maurice

@kripken
Copy link
Member

kripken commented May 20, 2024

This may have regressed in #21701 as those lines are added by link.py now, and @sbc100 maybe we run the closure lowering too early, or something like that?

@sbc100
Copy link
Collaborator

sbc100 commented May 20, 2024

Currently we run things like closure and transpilation only over the inner module code.

We could either fix this directly or, as you say, try to run the transpiler over the entire code including the module wrapper.

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

3 participants