-
-
Notifications
You must be signed in to change notification settings - Fork 33.5k
src: allow disabling JS source phase imports #60364
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
base: main
Are you sure you want to change the base?
Conversation
|
Review requested:
|
|
Maybe this could be similar to https://github.com/codebytere/node/blob/3bd7d18f84485e97e87fd056ca2820539b60d647/src/node.cc#L761-L766 and expect |
|
btw it looks like source phase imports don't work at all in node, so I'm not sure why they are enabled by default: |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #60364 +/- ##
==========================================
- Coverage 88.59% 88.58% -0.01%
==========================================
Files 704 704
Lines 208474 208401 -73
Branches 40067 40054 -13
==========================================
- Hits 184696 184612 -84
- Misses 15805 15811 +6
- Partials 7973 7978 +5
🚀 New features to boost your workflow:
|
|
Oh lol that's fun - i'm happy to just disable it by default again then? cc @GeoffreyBooth |
|
I think source phase import in Node.js only works with WASM, but not JS. |
|
Ok, then I think #60364 (comment) should work |
src/node_options.cc
Outdated
| "performance.", | ||
| &PerProcessOptions::disable_wasm_trap_handler, | ||
| kAllowedInEnvvar); | ||
| AddOption("--disable_js_source_phase_imports", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to recognize V8 style negate option --no-js-source-phase-imports, we should declare a --js-source-phase-imports as a V8Option, rather than declaring a standalone --disable....
|
Source phase imports now only work with WASM modules. JS source phase imports are waiting on https://github.com/tc39/proposal-esm-phase-imports. |
|
Indeed, JS source phase imports should be off by default until the feature is stage 3. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense. We don't have any snake case flags, perhaps just recase or follow @legendecas's suggestion? Either works for me.
Also I'm pretty sure that this will work with the other codepaths for source phase, but it would be good to check the existing instance phase test to ensure import * as foo from './foo.wasm' still works, by adding this flag to one of those tests in isolation from source phase.
3bd7d18 to
8015b0f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My suggestion shouldn't require to add a new option.
|
@targos then maybe I'm not clear on what you're suggesting? |
|
I'm suggesting to do the same as https://github.com/codebytere/node/blob/3bd7d18f84485e97e87fd056ca2820539b60d647/src/node.cc#L761-L766 Set the flag only if we don't find the |
8015b0f to
7495bbd
Compare
|
JS source phase imports should be disabled by default, though - isn't this keeping the opposite? |
The |
|
ah, thanks for explaining :-) |
Refs:
Electron need to disable source phase imports in renderer and worker processes - Chromium disables them in
content/renderer/render_process_impl.ccand the process will hard crash otherwise.Happy to move this to a different place if there's a better suggestion!