-
Notifications
You must be signed in to change notification settings - Fork 2.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
issues with package.json exports resolution #15053
Comments
Bottom line: As a module author I want to be able to write a module that exports "for node" and "for everything else" with two simple package.json exports. However the non-Node runtime's behaviour are in the way of being able to do that. |
My understanding is you should put the |
This comment was marked as off-topic.
This comment was marked as off-topic.
@guest271314 there are very valid reasons for module authors to want to run native node APIs in Node and Web APIs elsewhere. Hence the separation of node and "everything else". Just because you don't see the reason and need doesn't mean it is there. I will not get into the marketing false claims about node compatibility here. NB: experimental-default-type does nothing on this regard and if statements in the code increase bundle sizes with dead code for other than the intended runtime that can have its own bundle. |
This comment was marked as off-topic.
This comment was marked as off-topic.
Why are you advocating for willing module authors not supporting bun when they can? We're in this mess because of broken compat claims. I am able to publish modules that work in web api runtimes as well as node (and older node without the web apis) all the same. All i ask for is that i don't have to enumerate every non-node runtime (a list of which is never final) in the package json and instead have the ability to provide a node-specific build and one target for non-node runtimes. Today I can only do that if i keep on extending the package exports with every month's favourite new runtime flavour. 👎 |
This comment was marked as off-topic.
This comment was marked as off-topic.
This is not about the module CJS/ESM type flavour. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
I did. If you write your modules a different way and can't accept that others might have different ways of thinking of how interoperable modules should be structured, that's fine too |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
@panva i'm sorry we haven't fixed the node:crypto bugs blocking the If you want to force Bun to use the web api version, you can put an additional We will work on node:crypto more in about a month I expect |
This comment was marked as off-topic.
This comment was marked as off-topic.
@Jarred-Sumner thank you for thoughts. FWIW the issue here isn't necessarily about the Would you support the proposal from wintercg/runtime-keys#18?
This would not encoach on the runtime's ability to still target "node" as the proprietary resolution algorithm path. |
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 Bun will load the "node" condition in both examples above despite there being a default or, even worse offense, an explicit "bun" one.
The text was updated successfully, but these errors were encountered: