Hey all :wave: I was wondering whats the overall o...
# general
a
Hey all 👋 I was wondering whats the overall opinion about dependency inference and code that imports image files (svg, png, etc): should the dependency inference consider these files or should they be manually added as dependencies using the
files
target?
Context: I have a typescript + react frontend application that has
*.tsx
files and some of them import
*.svg
files in order to build the layout.
I know I can use the
files
target, set the
*.svg
as
sources
and use them as dependencies on the
tsx_sources
target, but
pants tailor
doesn't accomplish that for me and therefore a manual intervention is required, so I was wondering if it would make sense for the typescript dependency inference to consider these files? I guess that would also mean that tailor would have to handle target creation for these image files?
I'm curious how other people are handling these image files.
w
I’m on the fence about this. On one hand, I would naively expect this to work the same as other pants stuff - where the import dictates what should be included. On the other hand, something like
/static
doesn’t really have clear imports by default (necessarily). So maybe it’s a combination once the source root and import paths are aligned…
In my mind though, the ideal case would be to parse the existing bundler and use what it does - since they’re always updated, rather than porting everything to pants
For example, I’m trying to write a pants integration with deno2 - but in my case, Pants defers to deno2 for most of what it should do
a
I see, but in this case, how would pants be able to determine the digests for each source target?
w
By parsing the imports, no?
a
Yes, and if it finds certain image file extensions, it would need to consider they dependencies? Which target would these image files be represented by, a
files
target?