figwheel 2018-07-17

@lumpy has joined the channel

I’m trying to add swagger docs to my endpoints in a project using fig wheel. When I run figwheel from the command line it works. But, if I use figwheel in the cursive repl as documented here: https://github.com/bhauman/lein-figwheel/wiki/Running-figwheel-in-a-Cursive-Clojure-REPL I get this error

any idea what is causing this? I’m having trouble identifying the right part of the stacktrace to investigate.

So the issue seems to be that lein figwheel dev is using lein-figwheel plugin vs start-figwheel! is using figwheel_sidecar

@lumpy a common mistake when using sidecar is not having an environment that matches your figwheel environment

you often need to make sure that you have your cljs source code on the classpath as well as the same dependencies that you have when you run lein figwheel

do you mean environment in the project.clj?

I guess I don’t know how lein figwheel would get access to dependencies that sidecar doesn’t all are managed through project.clj

@lumpy well I know for sure that lein figwheel adds the :source-paths from your cljs builds to the classpath.

lein repl certainly doesn't

so to start you could add your cljs :source-paths to the top level :source-paths and see if that makes a difference

hmm, those are already the same, actually top level had “script” added where cljs didn’t have that

I don't know how cursive is starting the REPL

right, I assumed it was just running the script/repl file, but maybe more is happening

how is it building it's classpath? lein run?

anyway a different selection of dependencies can sometimes shuffle the resulting transitive dependencies to the point where you have a conflict

and I bet swagger is a big one

anyway this is one argument for the new CLI tools

ya, that makes sense.

although the same problems can happen

but the less magic from lein and plugins can make things more understandable, but less easy at first

I don’t think it’s using lein since the use clojure main in normal JVM process is selected

I'm writing a whole long tutorial on the classpath for figwheel.main right now

but I’m not sure

so it’s either that the dependencies are being added in a different way, or they aren’t being added at all

(System/getProperty "java.class.path")

not added at all is the first place I would look

as it's the most common problem