3 ms·
> Your CLJS library will not be a first class citizen in the JS world. It can be done but it's not a good idea. Why is this? What makes it a bad idea? Does Clo
by adamkl 6y ago
> Your CLJS library will not be a first class citizen in the JS world. It can be done but it's not a good idea.
Why is this? What makes it a bad idea? Does ClojureScript’s new ‘bundle’ compilation target [0] help resolve whatever issues you are referring to?
Genuinely curious.
[0] https://clojurescript.org/news/2020-04-24-bundle-target https://clojurescript.org/news/2020-04-24-bundle-target
- auganov 6y agoAny CLJS code has to bundle the CLJS runtime. CLJS doesn't compile to idiomatic JS, for example a vector will be a cljs.core/PersistentVector not a JS Array. So code for most CLJS basics has to be bundled with any CLJS code to run. Let's say you write a tiny library that solves just one problem. I would imagine most people wouldn't want to have to pull in the CLJS runtime for just that. So let me be clear - there is no problem in using JS libraries, what you linked speaks to using npm libraries which previously was tougher. CLJS is doing very well on that front. What I'm saying is - if you write a library in CLJS, don't expect plain JavaScripters to use it.