Skip to content

fix(turbo-trace): exclude require() calls when tracing type imports only - #13638

Draft
okxint wants to merge 1 commit into
vercel:mainfrom
okxint:fix/turbo-trace-require-types-filter
Draft

fix(turbo-trace): exclude require() calls when tracing type imports only#13638
okxint wants to merge 1 commit into
vercel:mainfrom
okxint:fix/turbo-trace-require-types-filter

Conversation

@okxint

@okxint okxint commented Aug 2, 2026

Copy link
Copy Markdown

find_require_calls was called unconditionally at the end of find_imports, regardless of the import_trace_type argument.

CommonJS require() calls always produce value imports (ImportType::Value). When a caller passes ImportTraceType::Types, only type-only imports should be returned, but require() calls were still appended to the results — every const x = require("./y") in the traced file appeared in a types-only trace output.

The fix guards the call behind a check: find_require_calls is now skipped entirely when import_trace_type == ImportTraceType::Types.

find_require_calls was called unconditionally in find_imports, ignoring
the import_trace_type parameter. CommonJS require() calls always produce
value imports (ImportType::Value), so they should be skipped entirely
when ImportTraceType::Types is requested.

Without this guard, a `turbo trace --type` run would include every
require() call in its output even though require() can never carry a
type-only import.
@vercel

vercel Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

@okxint is attempting to deploy a commit to the Internal Apps Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant