Fork me on GitHub

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?


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


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


I've done this sort of thing before with macros


@mattly browser or nodejs?


sounds like macros would be the easiest way


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


although beware that this would only be picked up while building


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


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