Skip to content

fix(turbopack): fall back after filtering declaration path aliases - #191

Draft
fireairforce wants to merge 1 commit into
utoofrom
zoomdong/dts-paths-fallback
Draft

fix(turbopack): fall back after filtering declaration path aliases#191
fireairforce wants to merge 1 commit into
utoofrom
zoomdong/dts-paths-fallback

Conversation

@fireairforce

@fireairforce fireairforce commented Sep 9, 2026

Copy link
Copy Markdown
Member

Summary

When a tsconfig path maps a runtime package import only to .d.ts files, filtering the declarations leaves no candidates. The current conversion turns that into ImportMapping::Ignore, so calling an imported function can emit (void 0)() instead of resolving the package's JavaScript entry.

Keep an empty alternatives mapping when declaration filtering removes every candidate. Resolution then falls back to the original package request, while the mapping still preserves its precedence over inherited and broader wildcard entries. Explicitly empty path arrays and other ignore mappings retain their existing behavior.

Validation

Validated through the utoo Pack integration harness:

  • Before the fix, the runtime regression fails with (void 0) is not a function; the missing-package regression also fails.
  • After the fix, 13 TypeScript tests pass, including browser-library and server execution, exact and wildcard mappings, inherited overrides, mixed candidate order, exports/main, missing-package diagnostics, and unchanged explicit ignore behavior.
  • cargo clippy -p turbopack-resolve --all-targets -- -D warnings --no-deps and Rust formatting checks pass.

Public reproduction: https://github.com/fireairforce/turbopack-dts-paths-repro

Companion utoo integration and executable regression tests: utooland/utoo#3344

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