-
Notifications
You must be signed in to change notification settings - Fork 30k
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
SyntheticModule
aborts with illegal hardware instruction
during linking
#32806
Comments
I think the reason is caused by node core modules have node/lib/internal/modules/esm/translators.js Lines 103 to 115 in 0f96dc2
|
as has been said above. This will crash too // a.mjs
export default {
} // file.mjs
import {SyntheticModule} from 'vm';
import * as fs from './a.mjs';
const m = new SyntheticModule(['default', ...Object.keys(fs)], function () {});
// this aborts
m.link(() => {
console.log('link')
}); |
The docs state that all builtins provide both named and default exports: https://nodejs.org/api/esm.html#esm_builtin_modules However, the issue seems to be duplicate // file.mjs
import {SyntheticModule} from 'vm';
const m = new SyntheticModule(['default', 'default'], function () {});
// this aborts
m.link(() => {
console.log('link')
}); |
oh, you're right. use a |
I'd expect node to yell at me for having duplicate names rather than silently dedupe them in this case. For my (real) use case, |
I'm working on this. |
@himself65 I think we should make a copy of the |
Fixes: #32806 PR-URL: #32810 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
Fixes: #32806 PR-URL: #32810 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
Fixes: #32806 PR-URL: #32810 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
It always happens
What is the expected behavior?
Node process shouldn't abort
What do you see instead?
It aborts
Additional information
Import
fs
viarequire
rather thanimport
doesn't abort.Is it not allowed to do
Object.keys
on the imported module? I find it weird it explodes only if doinglink
and not otherwiseThe text was updated successfully, but these errors were encountered: