-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
resolvePackageJsonExports
doesn't actually work
#54574
Comments
You actually can, sort of, do that: Note - please reorder |
Okay, I am seeing that in the docs But if |
Yeah, it works right now but might be misleading to users or copy-pasted to other projects where the situation will be different. |
@Andarist While I understand the order-dependence, does it matter for |
While this might feel odd at first - yes, What should resolve here and how exactly the algorithm should be written to make the rules clear if the overarching rule of {
"exports": {
"import": {
"types": "./foo.d.ts"
"default": "./bar.js"
},
"types": "./baz.d.ts"
}
} Of course, the outer Currently, it actually might be used as a fallback but that's considered a bug: #50762 |
fwiw I was referring more to how |
Yeah, but what you describe goes into "more rules" territory whereas the basic rule of order-dependency is pretty simple and using it uniformly helps educating the community at large about this fact. Diverging from it introduces a dangerous precedence and creates more complexity for other tools that try to replicate TS behavior when analyzing packages etc. In every other context those keys are order-dependent so treating |
I'm not seeing a bug described here. Generally we don't ship flags that are completely broken out of the gate? |
I think the confusing comes from the fact that this flag only works under TypeScript/src/compiler/utilities.ts Lines 8528 to 8543 in 9d17b34
That does look unintentional given the |
It just doesn't seem to do anything. Or the spec doesn't clarify when it should or shouldn't work. Basically, the goal would be getting a situation where you can leave off the Based on the docs, the aforementioned flag seems like it should use Also, limiting it to those mentioned modules resolutions also means it's not needed, no? Since those already use exports. |
This issue has been marked as 'Question' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
Bug Report
Using
node
module resolution doesn't examineexports
paths.adding
resolvePackageJsonExports: true
is accepted in the tsconfig, but doesn't actually work. It still says ts can't resolve it.🔎 Search Terms
resolvePackageJsonExports
🕗 Version & Regression Information
Latest
⏯ Playground Link
Can't use npm imports in the playground.
💻 Code
🙁 Actual behavior
Cannot find module '@newthink/ui' or its corresponding type declarations.
🙂 Expected behavior
Actually Work
The text was updated successfully, but these errors were encountered: