Skip to content
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

Add "no default conditions" option to cli and build API #12204

Open
vveisard opened this issue Jun 27, 2024 · 1 comment
Open

Add "no default conditions" option to cli and build API #12204

vveisard opened this issue Jun 27, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request good first issue Something that would be good for new contributors

Comments

@vveisard
Copy link
Contributor

vveisard commented Jun 27, 2024

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-conditions flag
  • for the bun build API, a noDefaultConditions property

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.

@vveisard vveisard added the enhancement New feature or request label Jun 27, 2024
@paperdave paperdave self-assigned this Jun 27, 2024
@paperdave paperdave added the good first issue Something that would be good for new contributors label Jun 27, 2024
@Catmanpooh
Copy link

I would like to give this issue a shot. Should I only worry about updating the cli and api or the removal of the "problematic" to give 100% control to the user? Am I jist working in the src/cli and src/api directories?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Something that would be good for new contributors
Projects
None yet
Development

No branches or pull requests

3 participants