fix: Resolve TypeScript .js extension imports to .ts files in boundaries#12644
Merged
anthonyshew merged 1 commit intoMay 6, 2026
Merged
Conversation
Contributor
|
@maschwenk is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
8487770 to
7f7df93
Compare
anthonyshew
approved these changes
May 5, 2026
anthonyshew
left a comment
Contributor
There was a problem hiding this comment.
Approving but we do require signed commits. Are you able to get that set up and update the commits on this branch?
b2a62f3 to
4534ccf
Compare
anthonyshew
pushed a commit
that referenced
this pull request
May 7, 2026
## Release v2.9.10-canary.1 > [!CAUTION] > Versioned docs aliasing FAILED. [View logs](https://github.com/vercel/turborepo/actions/runs/25414005119) ### Changes - fix: Preserve lockfiles during dry-run conversion (#12717) (`3192551`) - ci: Fix LSP workflow container matrix (#12718) (`ac55ec9`) - release(turborepo): 2.9.9-canary.4 (#12716) (`25c71b0`) - release(turborepo): 2.9.9 (#12719) (`acfe475`) - fix: Respect SCM env vars in `turbo query affected` (#12722) (`3caa8fb`) - ci: Package VSCode extension in release workflow (#12723) (`329a545`) - fix: Avoid raw create-turbo example telemetry (#12725) (`ec0b8dd`) - fix: Escape graph HTML payloads (#12726) (`89b4f4e`) - fix: Prevent OTEL token injection to spoofed origins (#12727) (`1fbc725`) - fix: Retry HTTP status failures (#12728) (`e389d66`) - fix: Validate microfrontend proxy Host header (#12730) (`eb46170`) - fix: Redact task hash env debug logs (#12733) (`6d9fc06`) - fix: Filter microfrontend proxy environments (#12732) (`9b28a75`) - fix: Preserve FSEvents mount points for device-relative paths (#12729) (`6ce73e0`) - fix: Validate proxy Host headers (#12731) (`9f70395`) - fix: Resolve TypeScript `.js` extension imports to `.ts` files in boundaries (#12644) (`b47f6dc`) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
anthonyshew
pushed a commit
that referenced
this pull request
May 7, 2026
## Release v2.9.10 > [!CAUTION] > Versioned docs aliasing FAILED. [View logs](https://github.com/vercel/turborepo/actions/runs/25509373774) ### Changes - release(turborepo): 2.9.9-canary.4 (#12716) (`25c71b0`) - release(turborepo): 2.9.9 (#12719) (`acfe475`) - fix: Respect SCM env vars in `turbo query affected` (#12722) (`3caa8fb`) - ci: Package VSCode extension in release workflow (#12723) (`329a545`) - fix: Avoid raw create-turbo example telemetry (#12725) (`ec0b8dd`) - fix: Escape graph HTML payloads (#12726) (`89b4f4e`) - fix: Prevent OTEL token injection to spoofed origins (#12727) (`1fbc725`) - fix: Retry HTTP status failures (#12728) (`e389d66`) - fix: Validate microfrontend proxy Host header (#12730) (`eb46170`) - fix: Redact task hash env debug logs (#12733) (`6d9fc06`) - fix: Filter microfrontend proxy environments (#12732) (`9b28a75`) - fix: Preserve FSEvents mount points for device-relative paths (#12729) (`6ce73e0`) - fix: Validate proxy Host headers (#12731) (`9f70395`) - fix: Resolve TypeScript `.js` extension imports to `.ts` files in boundaries (#12644) (`b47f6dc`) - fix: Use random temp path for repo downloads (#12736) (`106698c`) - release(turborepo): 2.9.10-canary.1 (#12734) (`b1001c1`) - fix: Reject OTel endpoints with userinfo (#12737) (`a6efc3f`) - fix: Authenticate local devtools WebSocket (#12738) (`8276be8`) - fix: Handle clipboard exec errors (#12739) (`3305766`) - fix: Restrict Vercel token reuse to trusted API origins (#12740) (`18a3a22`) - fix: Keep workspace config discovery inside root (#12741) (`86c0365`) - fix: Hardening for daemon IPC endpoints (#12742) (`13a9a8b`) - fix: Enforce cache filesystem boundaries (#12743) (`a50e863`) --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.
Description
turbo boundariesstill incorrectly flags tsconfigpathsaliases in ESM TypeScript projects (moduleResolution: "nodenext"or"bundler"). Given:turbo boundariesreports:This is the same symptom as
turbo boundariesdoes not understand tsconfig path aliases, incorrectly flags local imports as undeclared dependencies #11906.In
fixed the specific case where the resolver can resolve the alias, but did not teach the resolver TypeScript's rule that an explicit
.jsin the import specifier should fall back to.ts/.tsx/.d.tson disk. That's why the still-reproducible follow-up comment on #11906 ("this still isn't solved for me (2.8.17)") is a real bug and not user error.Root cause
Tracer::create_resolverincrates/turbo-trace/src/tracer.rsregistered.ts,.tsx, etc. as extensions to try when one is absent, but didn't setResolveOptions::extension_alias. So after tsconfig alias substitution, the resolver looks for the literal.jsfile, getsNotFound,check_import_as_tsconfig_path_aliasreturnsfalse, and the import falls through tocheck_package_import. For package-name-shaped aliases (test/*,features/*, etc.) that becomes an "undeclared dependency" diagnostic.Scoped-looking aliases like
@/foosilently pass today only becauseis_potential_package_namerejects@/<name>(the scope must be non-empty), skipping the package-check step. Same underlying bug, different visible behavior.Fix
Configure
extension_aliasto mirror TypeScript's nodenext / bundler resolution (and webpack'sresolve.extensionAlias):.js→.ts,.tsx,.d.ts,.js,.jsx.mjs→.mts,.mjs.cjs→.cts,.cjsReal npm-package imports that resolve through
node_modulesstill returnfalse(thanks to the existingnode_modulescomponent check incheck_import_as_tsconfig_path_alias) and fall through to the dependency-declaration check — so undeclared-dependency diagnostics are not weakened for real packages.Testing Instructions
Two regression tests added in
crates/turborepo-boundaries/src/imports.rs:tsconfig_alias_resolves_js_extension_to_ts_file— reproduces the exact scenario from the bug report: atest/*tsconfig alias, a.js-extension import, and a.tsfile on disk.tsconfig_alias_resolves_mjs_extension_to_mts_file— covers the.mjs→.mtsrewrite path.Manual reproduction
A minimal reproduction is an ESM TypeScript app with:
Before this PR:
turbo boundariesreports "cannot import packagetestbecause it is not a dependency".After this PR: no diagnostic.
Fixes #11906.
Made with Cursor