-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Deno uses "node" condition instead of "deno" when "node" condition placed first in package.json exports resolution #26789
Comments
Isn't this by design? You need to put "deno" before "node" in this case so that Deno loads the first matching condition (and Deno matches the "node" condition).
|
This is not a
question
I am pointing out that this is bad and more importantly, not expected, behaviour, especially in the first case when there is a Deno-specific export. |
As a module author I want to be able to write a module that exports "for node" and "for everything else" with two simple exports. And Deno (and also Bun's) behaviour is in the way of being able to do that. |
From my understanding of...
...you need to do the following:
...because otherwise Deno will match the "node" condition. It's critical Deno matches the "node" condition or else many packages will not work properly. |
If you're going to treat this like a Question I'm going to ask one: Please explain how a module author can achieve
Without Deno users being routed to the "node" export which, despite all the marketing, has its edge cases, especially when it comes to specifics of |
You can't do this without having a more specific exports condition above the "node" condition. The default conditions that Deno provides to the exports resolution algorithm is |
Refs: wintercg/runtime-keys#5
Refs: wintercg/runtime-keys#18
One can easily believe that the following exports condition examples mean "everything but node loads from the webapi dist".
Unfortunately Deno will load the "node" condition in both examples above despite there being a default or, even worse offense, an explicit "deno" one.
The text was updated successfully, but these errors were encountered: