Description
What is the problem this feature would solve?
In my app, I have a transitive dependency on a package which uses conditional exports to provide different behavior. Bun always resolves conditional exports using some default conditions (in my case the problematic one is "node") and exposes no API to remove these default conditions. Thus, I am unable to control which module I receive from the package.
What is the feature you are proposing to solve the problem?
I am proposing a new "no default conditions" option:
- for the bun cli, a
--no-default-conditionsflag - for the bun build API, a
noDefaultConditionsproperty
This option would remove all default conditions, and only use the conditions specified using the conditions option: https://bun.sh/blog/bun-v1.0.30#new-flag-conditions. Alternatively, this option could simply remove "problematic" conditions like "node" and "worker", and only include 'default', 'module', 'import' and 'require' (but I'd prefer if I had 100% control).
What alternatives have you considered?
In my particular case, I can pass the "browser" condition to bun, because my package incidentally uses the "browser" condition with the module I want before the "node" condition. However, this is not a proper solution.