Skip to content

node:module: route CJS entrypoint and CJS-via-ESM-import through Module._extensions - #35774

Closed
robobun wants to merge 9 commits into
mainfrom
farm/1256acbd/module-extensions-entrypoint-esm
Closed

robobun wants to merge 9 commits into
mainfrom
farm/1256acbd/module-extensions-entrypoint-esm

address review nits: query-stripped path for extension lookup, uncond…

da2416f
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Jul 25, 2026 in 44m 12s

Code review found 1 potential issue

Found 1 candidates, confirmed 1. See review comments for details.

Details

Severity Count
🔴 Important 0
🟡 Nit 1
🟣 Pre-existing 0
Severity File:Line Issue
🟡 Nit src/jsc/bindings/JSCommonJSModule.cpp:1680 m_pendingCustomExtension set unconditionally on already-evaluated modules

Annotations

Check warning on line 1680 in src/jsc/bindings/JSCommonJSModule.cpp

See this annotation in the file changed.

@claude claude / Claude Code Review

m_pendingCustomExtension set unconditionally on already-evaluated modules

Nit: `getOrCreateCommonJSModule` can return an already-evaluated module (e.g. `createRequire()('./dep.js')` followed by `await import('./dep.js')` under a `.js` override + `"type":"commonjs"`), and this line then unconditionally stashes `m_pendingCustomExtension` on it. Both consumers — `load()` and the synthetic-generator lambda — check `!hasEvaluated` BEFORE reading/clearing the field, so it's left set forever, violating the header-documented one-shot invariant; if user code later flips `modul