-
Notifications
You must be signed in to change notification settings - Fork 39
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
Auto-generate imports list from Babel? #41
Comments
Babel has a feature about processing each file in a isolation - there is no good way to process multiple files and create some combined result as a output (or I don't know it) |
I think the scan as it is now is too primitive; it's finding more or less imports than are being used (since the actual built code can import less, or import in imports from non-src directories), plus, it has to come up with the proper name and that's also not always correct (with the When the Babel plugin finds the imports, it finds all of the used ones and only the used ones, and it gets the correct name from the start. So maybe the babel plugin should use a shared file (or even small sqlite db)? Delete the file at the start of a compile and you won't have old imports. |
File path generation should be correct. I just need to add some edge cases for the resolution. |
Yes, but even if the path generation is correct, it will still find all import statements under the given directory, even if they're not used. |
That should not be a problem - it does not execute them. |
Found another issue: commented imports are also added, even if they don't exist And one more question: why are the imports generated as an object instead of a sorted array? It makes git changes bigger… |
No real reasons, and I could also generate a sorter object(no keep the current API) |
I think this way would not work well with caching, and next year would be a year of caching code compilation. |
Would it not be possible to automatically update the
imported-components.js
file that contains all the imports during Babel traversal?In any case, I had some trouble, it prefixed all node modules with
../
. Luckily, since it's just source code I could manually adjust it.BTW, your project is wonderful 😍 ! It worked as soon as I got the pieces in place. Great approach to the problem IMHO.
The text was updated successfully, but these errors were encountered: