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

fix: avoid warning when not needed, fix #314 #368

Merged
merged 1 commit into from
Apr 28, 2023

Conversation

damirbogdanov
Copy link
Contributor

Description

Hi,

First of all, I wanted to thank you for creating and maintaining unplugin-auto-import. I recently started using it in my project after it was recommended by Posva, and I have found it to be very helpful.

However, I ran into a tiny issue with the warning message that is displayed when no imports are defined. After investigating the issue, I realized that the warning message is not necessary in all cases, especially when the "dirs" option is specified.

To fix this issue, I modified the source code to check for the "dirs" option and skip the warning message if it is specified. Here is an example of how I use this package in my project:

require('unplugin-auto-import/webpack')({
  dirs: [path.resolve(__dirname, '../../app/javascript/stores')],
  dts: path.resolve(__dirname, '../../app/javascript/auto-imports.d.ts'),
}),

I do not need to define any imports explicitly. However, the warning message is displayed because no imports are defined.

With my modification, the warning message will not be displayed when the "dirs" option is specified, and the package will work as expected for my use case. This modification was partially requested in issue #314.

Thank you again for your contribution to the community, and I hope you find this modification useful. Please let me know if you have any questions or suggestions for improvement.

Linked Issues

#314

@antfu antfu changed the title fix: [DX] Avoid warning when not needed (#314) fix: avoid warning when not needed, fix #314 Apr 28, 2023
@antfu antfu merged commit e694050 into unplugin:main Apr 28, 2023
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 this pull request may close these issues.

2 participants