-
Notifications
You must be signed in to change notification settings - Fork 29.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
ERR_INTERNAL_ASSERTION with require(esm) #55500
Labels
confirmed-bug
Issues with confirmed bugs.
esm
Issues and PRs related to the ECMAScript Modules implementation.
loaders
Issues and PRs related to ES module loaders
Comments
The relevant code is in What is going on is that:
However, a minimal reproduction of |
Minimal reproduction: try {
require("./file-with-tla.mjs");
} catch {
import("./file-with-tla.mjs").then(console.log, console.error);
} |
RedYetiDev
added
esm
Issues and PRs related to the ECMAScript Modules implementation.
loaders
Issues and PRs related to ES module loaders
confirmed-bug
Issues with confirmed bugs.
labels
Oct 23, 2024
// tla.js
await new Promise(resolve => resolve()); try {
require("./tla.js");
} catch {
import("./tla.js");
} |
Failing assertion: node/lib/internal/modules/esm/module_job.js Line 358 in 7b5d660
|
Thanks for reporting it, fix in #55502 |
Ceres6
pushed a commit
to Ceres6/node
that referenced
this issue
Oct 30, 2024
When a ESM module cannot be loaded by require due to the presence of TLA, its module status would be stopped at kInstantiated. In this case, when it's imported again, we should allow it to be evaluated asynchronously, as it's also a common pattern for users to retry with dynamic import when require fails. PR-URL: nodejs#55502 Fixes: nodejs#55500 Refs: nodejs#52697 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
RafaelGSS
pushed a commit
that referenced
this issue
Nov 1, 2024
When a ESM module cannot be loaded by require due to the presence of TLA, its module status would be stopped at kInstantiated. In this case, when it's imported again, we should allow it to be evaluated asynchronously, as it's also a common pattern for users to retry with dynamic import when require fails. PR-URL: #55502 Fixes: #55500 Refs: #52697 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
louwers
pushed a commit
to louwers/node
that referenced
this issue
Nov 2, 2024
When a ESM module cannot be loaded by require due to the presence of TLA, its module status would be stopped at kInstantiated. In this case, when it's imported again, we should allow it to be evaluated asynchronously, as it's also a common pattern for users to retry with dynamic import when require fails. PR-URL: nodejs#55502 Fixes: nodejs#55500 Refs: nodejs#52697 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
confirmed-bug
Issues with confirmed bugs.
esm
Issues and PRs related to the ECMAScript Modules implementation.
loaders
Issues and PRs related to ES module loaders
Version
23.0.0
Platform
Subsystem
No response
What steps will reproduce the bug?
EDIT: See in #55500 (comment) for a minimal reproduction
yarn install
make use-esm
(cd ./packages/babel-core/test/fixtures/async/plugin-mjs-tla-native; node ../../babel-compile-async.mjs ./input.js)
How often does it reproduce? Is there a required condition?
I don't have a minimal reproduction
What is the expected behavior? Why is that the expected behavior?
To not tell me to open a bug report :P
What do you see instead?
Additional information
I don't think I'm using Node.js internals.
cc @joyeecheung
The text was updated successfully, but these errors were encountered: