Repository navigation
require.cache entries missing children for dynamically imported CommonJS TypeScript files #61385
Description
Activity
Cross-link to marginally related #59868
Cross-link to marginally related #59868
@zachleat The linked issue is referenced from #59874 which seems to explain the behavior you are experiencing unless I'm missing something.
Specifically: https://github.com/nodejs/node/pull/59874/files#diff-1b1ae477505d4d28dcbc36f9983381a62ee28ffa354dc85ad008ffa8c764cabeR8
UPDATE: Sorry for the spam, probably confusing ESM and CommonJS here.
@backflip it was a good thought! But yeah the target TypeScript file is CommonJS there
github-actions commented
on Jul 20, 2026 on Jul 20, 2026 – with GitHub ActionsContributorMore actionsThis issue has been marked as stale due to 90 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.- addedstaleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.Issues and PRs marked stale due to inactivity and scheduled for automatic closure.
on Jul 20, 2026 I did retest and this appears to be fixed with v26.5.0 (2 children, fixed):
'/Users/zachleatherman/Temp/node-issue-61385/target.ts': { id: '/Users/zachleatherman/Temp/node-issue-61385/target.ts', path: '/Users/zachleatherman/Temp/node-issue-61385', exports: {}, filename: '/Users/zachleatherman/Temp/node-issue-61385/target.ts', loaded: true, children: [ [Object], [Object] ], paths: [ '/Users/zachleatherman/Temp/node-issue-61385/node_modules', '/Users/zachleatherman/Temp/node_modules', '/Users/zachleatherman/node_modules', '/Users/node_modules', '/node_modules' ], Symbol(kIsCachedByESMLoader): true, Symbol(kFormat): 'commonjs-typescript', Symbol(kURL): 'file:///Users/zachleatherman/Temp/node-issue-61385/target.ts', Symbol(kIsExecuting): false },v24.18.0 (empty children, broken):
'/Users/zachleatherman/Temp/node-issue-61385/target.ts': { id: '/Users/zachleatherman/Temp/node-issue-61385/target.ts', path: '/Users/zachleatherman/Temp/node-issue-61385', exports: {}, filename: '/Users/zachleatherman/Temp/node-issue-61385/target.ts', loaded: true, children: [], paths: [ '/Users/zachleatherman/Temp/node-issue-61385/node_modules', '/Users/zachleatherman/Temp/node_modules', '/Users/zachleatherman/node_modules', '/Users/node_modules', '/node_modules' ], Symbol(kIsCachedByESMLoader): true },
Version
v24.13.0
Platform
Subsystem
No response
What steps will reproduce the bug?
where
target.tscontains:Running
node index.jsshows an empty array forchildren: []when it should be populated with 2 entries.Notably,
import()does add an entry torequire.cachefortarget.ts(and a hypotheticaltarget.js) but only the TypeScript version is missing the correct value forchildren.Workaround: use
requirefor CommonJS TypeScript instead of dynamic import.How often does it reproduce? Is there a required condition?
100% consistent every time
What is the expected behavior? Why is that the expected behavior?
I would expect the
childrenArray to have two entries for therequire()’d dependencies.What do you see instead?
children: [](empty Array)Additional information
No response