Fork me on GitHub

I’m hoping someone can help me understand a bit of the piggieback docs with respect to setting up through fireplace and accommodating foreign libs:


> When using Piggieback to enable a browser REPL: the ClojureScript compiler defaults to putting compilation output in out, which is probably not where your ring app is serving resources from (resources, target/classes/public, etc). Either configure your ring app to serve resources from out, or pass a cljs-repl :output-dir option so that a reasonable correspondence is established.


so at the repl I’m manually instantiating an nrepl, spitting out .nrepl-port OK, evaluating fine through fireplace as long as it’s CLJ


I’m using figwheel, and starting that up OK via (figwheel.main.api/start "dev") (using a dev.cljs.edn at my project root)


browser’s working at this point


next, in vim :Piggieback (figwheel.main.api/repl-env "dev") succeeds


and I can eval (js/alert "WHATUP?") and see it in the browser


now the twist:


I’m using reagent, but React is coming in through a foreign-lib (using the clojurescript-webpack setup on and so I’m excluding from the reagent dep, ie. reagent {:mvn/version "0.8.1" :exclusions [cljsjs/react cljsjs/react-dom cljsjs/react-dom-server cljsjs/create-react-class]}


and if my vim buffer is in a namespace that requires reagent, the Fireplace eval blows up with clojure.lang.ExceptionInfo: No such namespace: react, could not locate react.cljs, react.cljc, or JavaScript source providing "react" in file file:/Users/rgm/.m2/repository/reagent/reagent/0.8.1/reagent-0.8.1.jar!/reagent/core.cljs {:tag :cljs/analysis-error} (and long stacktrace follows)


note that figwheel’s clojurescript compile is picking up the foreign-lib react just fine (evidence: the browser app works, and using a cljs-repl outside vim can eval within namespaces and the browser picks up the results, eg. if I do a re-frame dispatch I see the UI change appropriately)


it just seems like Piggieback doesn’t know about the foreign libs, so I’m wondering if it doesn’t know to look at target/public/cljs-out/dev for build products


So, finally, my actual distilled question (apologies):


Can I configure piggieback somehow to look at Figwheel’s build dir target/public/cljs-out/dev, or is it better to change Figwheel to put the build products where piggieback seems to require them to be? (ie. out/)


(btw huge thanks to whoever wrote this guide to vim in the figwheel-main repo docs:

❤️ 4

That was me thanks! 🙂


Hope everything else worked out for you. I'm pretty new to Clojure as well so haven't come across the issue you were having


bhauman is pretty active here in slack so you may want to ping him on #figwheel-main