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

Enable injectAtEnd from unimport #19480

Closed
3 of 4 tasks
antfu opened this issue Mar 6, 2023 · 1 comment · Fixed by #28822
Closed
3 of 4 tasks

Enable injectAtEnd from unimport #19480

antfu opened this issue Mar 6, 2023 · 1 comment · Fixed by #28822

Comments

@antfu
Copy link
Member

antfu commented Mar 6, 2023

Describe the feature

Currently, unimport always injects the imports at the beginning of the file. This sometimes creates confusing circular reference errors, or alters the order of the imports.

To improve this, I implemented injectAtEnd feature (unjs/unimport@6b1ba91) on unimport but not enabled by default yet.

https://github.com/unjs/unimport/blob/1be4b7baba7af772ea863f2bfe529daa2830bc12/src/types.ts#L256-L261

Enabled on https://github.com/antfu/unplugin-auto-import by default and it does solve some circular reference issues. So far, I guess it works for most of the cases, and only a potential bug needs to be investigated: unplugin/unplugin-auto-import#327

Creating this issue to raise this up, and see if you think it something worth to have in the next minor or so.

Additional information

  • Would you be willing to help implement this feature?
  • Could this feature be implemented as a module?

Final checks

@danielroe
Copy link
Member

danielroe commented Sep 3, 2024

If you still think this is worth adopting, let's go ahead with this for v4/v3.14.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Later
Development

Successfully merging a pull request may close this issue.

2 participants