node/lib/internal/modules/cjs
Joyee Cheung 5065a0acb3
module: do not invoke resolve hooks twice for imported cjs
Previously the resolve hook can be invoked twice from the
synthetic module evaluation step of imported CJS in the extra
module._load() call that's invoked on the resolved full path.
Add an option to avoid it, since the resolution and loading
has already been done before.

PR-URL: https://github.com/nodejs/node/pull/61529
Backport-PR-URL: https://github.com/nodejs/node/pull/62029
Fixes: https://github.com/nodejs/node/issues/57125
Refs: https://github.com/nodejs/node/issues/55808
Refs: https://github.com/nodejs/node/issues/56241
Reviewed-By: Jacob Smith <jacob@frende.me>
Fixes: https://github.com/nodejs/node/issues/61801
2026-04-27 18:03:26 +02:00
..
loader.js module: do not invoke resolve hooks twice for imported cjs 2026-04-27 18:03:26 +02:00