-
-
Notifications
You must be signed in to change notification settings - Fork 30.6k
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
Emscripten support: Use es6 modules #126898
Labels
Comments
hoodmane
added a commit
to hoodmane/cpython
that referenced
this issue
Nov 16, 2024
hoodmane
added a commit
to hoodmane/cpython
that referenced
this issue
Nov 16, 2024
hoodmane
added a commit
to hoodmane/cpython
that referenced
this issue
Nov 16, 2024
…try script We delete `node_pre.js` and `--pre-js`. Instead that logic moves to `node_entry.mjs`. In order to access `FS` from outside of `python.mjs`, we need to add `-sEXPORTED_RUNTIME_METHODS=FS`. Instead of invoking `python.js` directly, we will invoke `node_entry.mjs`. Special care has to be taken to ensure that we get `sys.executable` correct. It should point to the original path that was invoked, without symlinks resolved. I updated the generated `python.sh` to calculate it's own absolute path with `realpath -s $0` and pass that in. Then `node_entry.mjs` sets `thisProgram` to the path passed in. I manually validated this by creating a symlink to `python.sh` and invoking it. `sys.executable` and `sys._base_exectable` indeed point to the symlink, not to the build directory `python.sh` and not to `node_entry.mjs`.
hoodmane
added a commit
to hoodmane/cpython
that referenced
this issue
Nov 16, 2024
We delete `node_pre.js` and `--pre-js`. Instead that logic moves to `node_entry.mjs`. In order to access `FS` from outside of `python.mjs`, we need to add `-sEXPORTED_RUNTIME_METHODS=FS`. Instead of invoking `python.js` directly, we will invoke `node_entry.mjs`. Special care has to be taken to ensure that we get `sys.executable` correct. It should point to the original path that was invoked, without symlinks resolved. I updated the generated `python.sh` to calculate it's own absolute path with `realpath -s $0` and pass that in. Then `node_entry.mjs` sets `thisProgram` to the path passed in. I manually validated this by creating a symlink to `python.sh` and invoking it. `sys.executable` and `sys._base_exectable` indeed point to the symlink, not to the build directory `python.sh` and not to `node_entry.mjs`.
freakboy3742
pushed a commit
that referenced
this issue
Nov 21, 2024
Modify Emscripten support to use ES6 modules.
Thank you! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We are in the future and ES6 module support is finally universal in mainstream JavaScript runtimes (Firefox was the straggler but finally added Module WebWorker support in v114 released on June 6 2023). They have many benefits, such as fewer global variables and more sanity. We should switch to using them.
cc @freakboy3742
Linked PRs
The text was updated successfully, but these errors were encountered: