-
Notifications
You must be signed in to change notification settings - Fork 13k
Disable package.json conditional exports fallback lookups #62310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR disables package.json conditional exports fallback lookups by modifying the module resolution logic to return immediately when a condition fails to resolve, preventing TypeScript from falling back to other conditions like 'types' when the primary condition ('import') doesn't find TypeScript declaration files.
Key changes:
- Modified module resolution logic to stop searching after first failed condition
- Updated test baselines to reflect the new resolution behavior where .mjs files are resolved directly instead of falling back to .d.ts files
- Removed outdated comments describing the previous fallback behavior
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
src/compiler/moduleNameResolver.ts | Added early return to prevent fallback condition searches |
tests/cases/conformance/moduleResolution/conditionalExportsResolutionFallback.ts | Removed comment describing old fallback behavior |
tests/baselines/reference/*.trace.json | Updated trace logs showing direct .mjs resolution instead of .d.ts fallback |
tests/baselines/reference/*.errors.txt | Removed comments about fallback behavior from error baselines |
...aselines/reference/conditionalExportsResolutionFallback(moduleresolution=bundler).trace.json
Show resolved
Hide resolved
...selines/reference/conditionalExportsResolutionFallback(moduleresolution=nodenext).trace.json
Show resolved
Hide resolved
@typescript-bot test top800 |
@andrewbranch Here are the results of running the top 800 repos with tsc comparing Something interesting changed - please have a look. Details
|
@andrewbranch Here are some more interesting changes from running the top 800 repos suite Details
|
@andrewbranch Here are some more interesting changes from running the top 800 repos suite Details
|
@andrewbranch Here are some more interesting changes from running the top 800 repos suite Details
|
@andrewbranch Here are some more interesting changes from running the top 800 repos suite Details
|
@andrewbranch Here are some more interesting changes from running the top 800 repos suite Details
|
@andrewbranch Here are some more interesting changes from running the top 800 repos suite Details
|
@andrewbranch Here are some more interesting changes from running the top 800 repos suite Details
|
@andrewbranch Here are some more interesting changes from running the top 800 repos suite Details
|
@andrewbranch Here are some more interesting changes from running the top 800 repos suite Details
|
This may well be more breaky than it's worth. We might just be stuck with this :/ |
Fixes #50762