-
-
Notifications
You must be signed in to change notification settings - Fork 187
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
🐛 Knip does not resolve package.json exports quite correctly #853
Comments
Thanks for report. That's correct according to the Node.js docs and honestly I'm a bit baffled by it:
From a Knip perspective, the issues I have with this:
What about this workaround, would this work:
Just curious, not saying it's a solution. |
Unfortunately the workaround you proposed is not working with
where glob is the default (to remain non-breaking) and would become |
Just saying, the generic (and intended) solution to this is to add {
"entry": ["./src/public/{a,b}/index.ts"]
} At this point this feels better than rewriting |
I'll have to try it, but I think that next major i there is one should handle |
Understood, but this is a good example of static analysis versus runtime behavior and there are tradeoffs to be considered. |
Prerequisites
Reproduction url
maastrich/repro#2
Reproduction access
Description of the issue
First, thanks for the amazing tool, it's really impressive how quick and effective knip is 👏
When setting up exports using glob syntax in the package.json, typescript can resolve
*
to be either a path part or multiple path part:but knip doesn't
For the moment I've found a workaround where I add this in my package.json so knip can resolve le path
(leaving both as typescript resolve the first one and knip the second)
"./*": "./src/public/*/index.ts", + "./**": "./src/public/**/index.ts",
The text was updated successfully, but these errors were encountered: