mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 12:20:27 +01:00
esm: show race error message for inner module job race
The race can not only happen when the ESM is loaded by the CommonJS loader, but can also happen to inner module jobs in the dependency graph. PR-URL: https://github.com/nodejs/node/pull/59519 Fixes: https://github.com/nodejs/node/issues/59366 Refs: https://github.com/abejfehr/node-22.18-issue-repro Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
This commit is contained in:
parent
f8d68d30ae
commit
db70ceb49f
|
|
@ -471,6 +471,10 @@ class ModuleLoader {
|
|||
const resolvedImportAttributes = resolveResult.importAttributes ?? importAttributes;
|
||||
let job = this.loadCache.get(url, resolvedImportAttributes.type);
|
||||
if (job !== undefined) {
|
||||
// TODO(node:55782): this race may stop happening when the ESM resolution and loading become synchronous.
|
||||
if (!job.module) {
|
||||
assert.fail(getRaceMessage(url, parentURL));
|
||||
}
|
||||
// This module is being evaluated, which means it's imported in a previous link
|
||||
// in a cycle.
|
||||
if (job.module.getStatus() === kEvaluating) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user