figwheel

general discussion about figwheel, specific discussions in #figwheel-main and #lein-figwheel
lumpy 2018-07-17T18:38:20.000378Z

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

lumpy 2018-07-17T18:39:46.000155Z

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

lumpy 2018-07-17T18:54:57.000038Z

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

bhauman 2018-07-17T19:41:44.000162Z

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

bhauman 2018-07-17T19:43:06.000184Z

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

lumpy 2018-07-17T19:51:23.000421Z

do you mean environment in the project.clj?

lumpy 2018-07-17T19:58:25.000327Z

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

bhauman 2018-07-17T19:59:35.000177Z

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

bhauman 2018-07-17T19:59:43.000422Z

lein repl certainly doesn't

bhauman 2018-07-17T20:01:41.000161Z

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

lumpy 2018-07-17T20:03:35.000449Z

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

bhauman 2018-07-17T20:03:50.000059Z

I don't know how cursive is starting the REPL

lumpy 2018-07-17T20:05:04.000405Z

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

bhauman 2018-07-17T20:05:48.000102Z

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

bhauman 2018-07-17T20:06:43.000315Z

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

bhauman 2018-07-17T20:07:08.000453Z

and I bet swagger is a big one

bhauman 2018-07-17T20:07:50.000207Z

anyway this is one argument for the new CLI tools

lumpy 2018-07-17T20:08:12.000106Z

ya, that makes sense.

bhauman 2018-07-17T20:08:16.000497Z

although the same problems can happen

bhauman 2018-07-17T20:08:57.000101Z

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

lumpy 2018-07-17T20:09:55.000452Z

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

bhauman 2018-07-17T20:09:56.000117Z

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

lumpy 2018-07-17T20:10:02.000192Z

but I’m not sure

lumpy 2018-07-17T20:10:58.000385Z

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

bhauman 2018-07-17T20:11:19.000349Z

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

bhauman 2018-07-17T20:11:39.000486Z

not added at all is the first place I would look

bhauman 2018-07-17T20:11:59.000277Z

as it's the most common problem

lumpy 2018-07-17T20:12:12.000028Z

ok