Fork me on GitHub
#shadow-cljs
<
2018-11-16
>
kenran_22:11:16

Hi! I'm currently learning Clojure(Script) and web development in general, and I'm interested in understanding the tooling. So far I've created a very small playground app and I'm using lein and figwheel-main. But I want to give shadow-cljs a try since it looks awesome. One question before I start actually porting stuff would be: I am depending on a library that has react as a dependency via cljsjs iirc. Does that pose a problem when switching to shadow-cljs? Or can I exclude those and get react into the project via node?

lilactown23:11:32

shadow-cljs ignores cljsjs. so you can install react/react-dom as an npm dependency and it will just work

mattly22:11:55

is there an easy way in shadow-cljs watch mode to expose the value of an environment variable to a value in cljs-land?

mattly22:11:02

I've done this sort of thing before with macros

lilactown23:11:08

@mattly browser or nodejs?

lilactown23:11:36

sounds like macros would be the easiest way

mattly23:11:09

of course now I'm realizing that I only need env vars for local development, and then to derive everything from the url for the compiled js

lilactown23:11:25

although beware that this would only be picked up while building

lilactown23:11:50

yeah, that's how we do it - we key off the particular URL the script is loaded in

lilactown23:11:18

feels like a hack at first, but it means that we don't have to rebuild it based on what environment we want to deploy to