fix bt eval with monorepo and without extensions in imports#15
Open
fix bt eval with monorepo and without extensions in imports#15
Conversation
|
Latest install commands for this PR (updated for commit
|
ankrgyl
reviewed
Feb 13, 2026
Comment on lines
+206
to
+208
| // Fallback: read from argv for backwards compatibility (e.g., running | ||
| // the eval-runner directly outside of bt). | ||
| return process.argv.slice(2); |
Author
Author
There was a problem hiding this comment.
customer will try again on monday so we have time to get this right
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix 1: TypeScript extension resolution in installNodeModuleHooks (lines 399-472)
The resolve hook now wraps the next() call in a try/catch. When resolution fails for an extensionless relative specifier (like ./processors/tool-call-processor), it retries with .ts, .tsx, .mts, .cts extensions appended. This makes module.registerHooks() (Node 22.14+/23.5+) handle extensionless TS imports natively, so both require() and import() work without tsx hooks.
Fix 2: ESM-package-aware loading order in loadFiles (lines 821-920)
The old code always tried require() first for .ts files. On Node < 22.14, calling require() on a file in a "type": "module" package triggers require-of-ESM, which can corrupt the module graph and cause the "Unexpected status" internal assertion error (nodejs/node#54577).
The new code adds isInsideEsmPackage() to check the nearest package.json. For TS files in "type": "module" packages, it now tries import() first. This avoids the CJS/ESM interop bug on older Node versions while preserving the original require()-first behavior for CJS packages (where tsx's hooks work best).
Fix 3: if customers use parseArgs with strict will throw an exception because we passed files in the args