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

[RFC] Deprecate wildcard exports #469

Closed
huozhi opened this issue Mar 3, 2024 · 3 comments · Fixed by #465
Closed

[RFC] Deprecate wildcard exports #469

huozhi opened this issue Mar 3, 2024 · 3 comments · Fixed by #465

Comments

@huozhi
Copy link
Owner

huozhi commented Mar 3, 2024

In the previous versions we introduced a convenient mode: wildcard exports that allows you to write * to match all the exports.
However this makes the exports matching more complex and unpredicable.

Imaging you have entries:

- src
  |- foo
      | - index.js
      | - index.development.js
  |- bar
      | - index.edge-light.js

Where foo has development optimize condition but bar only has a edge runtime condition.
And when you are using * in exports config like below

   "./*": {
      "import": "./dist/*.mjs",
      "require": "./dist/*.cjs"
   }

It will make the exports parser super difficult to match it also it might mismatch the cases since each condition have different export. If you enumerate all cases in package.json like below, it's also not accurate since you don't know some has this condition development and another probably don't.

   "./*": {
      "development": "./dist/*.mjs",
      "edge-light": "./dist/*.mjs",
      "import": "./dist/*.mjs",
      "require": "./dist/*.cjs"
   }

Another limitcation is it's hard to use the extension to decide if you want to output cjs or mjs.

With another introduced feature bunchee --prepare we probably don't need anything to do it manually, instead you can just run the command. Comparing to the uncertain and unclear configuration, I decdided to deprecate the wildcard feature.

@huozhi huozhi changed the title Deprecate wildcard exports [RFC] Deprecate wildcard exports Mar 3, 2024
@huozhi
Copy link
Owner Author

huozhi commented Mar 3, 2024

cc @devjiwonchoi

@devjiwonchoi
Copy link
Contributor

100% agreed. This feature needed more thought on edge cases before building it, I did rush. Thank you for letting me know ahead!

@huozhi
Copy link
Owner Author

huozhi commented Mar 3, 2024

Thank you, I wouldn't say it's a less considered feature, it's more like with the project evolving we have different ways to handle the cases and bump to the new obstacles

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants