Fork me on GitHub
#figwheel
<
2018-07-17
>
lumpy18:07:20

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

lumpy18:07:46

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

lumpy18:07:57

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

bhauman19:07:44

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

bhauman19:07:06

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

lumpy19:07:23

do you mean environment in the project.clj?

lumpy19:07:25

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

bhauman19:07:35

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

bhauman19:07:43

lein repl certainly doesn't

bhauman20:07:41

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

lumpy20:07:35

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

bhauman20:07:50

I don't know how cursive is starting the REPL

lumpy20:07:04

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

bhauman20:07:48

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

bhauman20:07:43

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

bhauman20:07:08

and I bet swagger is a big one

bhauman20:07:50

anyway this is one argument for the new CLI tools

lumpy20:07:12

ya, that makes sense.

bhauman20:07:16

although the same problems can happen

bhauman20:07:57

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

lumpy20:07:55

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

bhauman20:07:56

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

lumpy20:07:02

but I’m not sure

lumpy20:07:58

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

bhauman20:07:19

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

bhauman20:07:39

not added at all is the first place I would look

bhauman20:07:59

as it's the most common problem