-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
package.json "exports" field fallback array support #4439
Comments
Vite uses resolve.exports to resolve exports vite/packages/vite/src/node/plugins/resolve.ts Lines 550 to 554 in 024a2de
But it does not support alternatives, it will only return the first path in the array: Alternatives is a great feature, I want to contribute it,I have two thoughts:
@Shinigami92 @patak-js |
I think this should be made at the library. |
let resolve.exports return an array and let vite choose a path that can be used will be more practicable. |
There's a issue upstream for this: lukeed/resolve.exports#17 |
FYI Currently, Node.js does not fallback to trying the next path if one is unresolvable. In addition to Webpack, TypeScript seems to support this too (source). Discussion here: |
The maintainer of |
I actually implemented exports/imports resolution with all the bugs from |
See #10504 |
Closes vitejs#4439 More context: vitejs#10504
This is supported in |
Note: Vite has upgraded to
I'm leaning towards no1 to follow the spec, but also I'm not sure why packages would export missing files if no2 is supported. |
In the last team meeting, we've decided to follow node as it defines the In the original issue description, |
Clear and concise description of the problem
Currently vite does not support fallback array in "exports" field in package.json, vite does support array type but when first entrypoint is not accessable, an error will show. webpack 5 has already has a implementation in Alternatives.
Suggested solution
add fallback array support
Alternative
No response
Additional context
Validations
The text was updated successfully, but these errors were encountered: