I am building a clojurescript application that depends on react-apollo to interact with third party graphql API. Since I could not figure out a way to load the library with all dependencies externally, I opted to npm install it and let the whole dependency get compiled by closure compiler. This did not work out of the box and required fork-and-patch on some js dependencies that confuses google closure compiler due to mix of ES6 and CommonJS require/import.
With advanced optimization, I was only able to get things working after fishing out renamed properties in the js debugger. And I'm sure my extern file does not have everything. I also need to make sure all properties are addressed by string in clojurescript, I think graphql creates object based on string in the query.
With string keys, things like destructuring don't work. Transforming objects with js->clj :keywordize-keys true and back seems to rename properties unless I add every keyword to the extern file.
I tried setting *warn-on-infer* and :infer-externs, but the generated extern has very few entry. Not sure if I'm using it right.
Advanced optimization seems like a must though, it's 461K vs 3MB with simple.
TL;DR
Tried to use npm lib in cljs, issues with advanced optimizations. What is the best practice to use these libs?