Closed mikabytes closed 10 months ago
I think this makes sense. I personally don't have a need for this but I'd be happy to help reviewing a PR! There are two parts to this. First, we need to make sure the "export" syntax in ./file1.js
is recognized and indexed by import-js (here I think). Then we need to find custom elements like the ones in ./file2.js
, likely here: https://github.com/Galooshi/import-js/blob/master/lib/findUsedIdentifiers.js
Thanks for the pointers! I might start work on this already tomorrow if nothing else comes up.
I think we also need a configuration option to enable/disable this feature. Some people like to import their custom elements in a separate file (custom elements is a global registry)
It's been 2 years.
While I did implement a solution that worked for my use case, it was evident in my company that it was too opinionated to be made into a general solution. People name their custom elements based on their convention.
In the end, I had an idea for a more general plugin-style extension for ImportJS but never got around to writing it.
Closing this due to it being stale. Might reopen in the future.
Perhaps this idea is a bit esoteric, but consider this situation:
./file1.js
./file2.js
I'd like ImportJS to add
import './file1.js'
to file2.jsThe html`` template literal syntax is widely adopted in JavaScript community. Used by LitHtml, with support by Prettier, syntax support is available for Vim, Visual Studio and probably many others. If we could teach ImportJS to understand them as well, it would be a great addition and a huge win for me :)