Fork me on GitHub
#clojurescript
<
2022-01-22
>
clarice13:01:44

👋 I have a plain old external JS library that has been chunked by Webpack. The library will always have an index file and then numerous chunks depending on what was exported at that time. I can reference the index file via foreign libs but what best practice do I follow to copy the rest of the resources across to it’s appropriate target directory on build? (targets may differ from the location of the index file). Let me know how I need to clarify if something doesn’t make sense. 🙏

p-himik13:01:29

Assuming I understand you correctly, that would depend on your build tool. E.g. with shadow-cljs you don't even need :foreign-libs and you can use its build hooks to copy the files around. Alternatively, you don't necessarily need to copy the files - you just need to include their parent dir in the classpath. Only the actually used files will be compiled, so it's OK for that dir to include other files as well.

clarice13:01:16

Oh, I didn’t even consider the classpath. Let me try that 🤞 I’ll let you know shortly. Also, I am using figwheel main with deps.

clarice13:01:08

I feel really silly now :rolling_on_the_floor_laughing: Thank you for guiding me. What I needed, in this particular scenario, is to make sure the files I need reside in the public directory.

👍 2
1
sova-soars-the-sora17:01:48

@UCM1FJA4E i've done that multiple times 😅

❤️ 1