Fork me on GitHub
#lein-figwheel
<
2019-04-10
>
socksy12:04:45

i know this must be a question you get a lot around here, but i feel like i’m tantalizing close to getting figwheel working with nREPL.

socksy12:04:40

I’m updating an older project that used to work fine with nREPL, and as the final command runs lein with-profile dev figwheel build1 build2 etc

socksy12:04:02

i’ve updated all the dependencies, and currently have

:figwheel {:css-dirs   ["resources/public/719998b2-df4b-4b86-9793-3f821d281369/css"]
             :repl       true
             :readline false
             :nrepl-port 7888
             :nrepl-middleware ["cider.nrepl/cider-middleware"
                                ;"refactor-nrepl.middleware/wrap-refactor"
                                "cider.piggieback/wrap-cljs-repl"]}
in my project.clj, where both cider.piggieback and cider-middleware are in the :profiles {:dev {:dependencies []}} vector

socksy12:04:30

my cider version in emacs is 0.21.0-SNAPSHOT, so I’ve put that in the dependencies, along with overriding nrepl to be 0.6.0, which I am aware may not be best practice with a shared project, but right now am concentrating on getting it working at all

socksy12:04:26

I can connect to the nrepl port 7888 (although no .nrepl-port file is created so I have to type it manually)

socksy12:04:48

I get as far as

user> (use 'figwheel-sidecar.repl-api)
nil
user> (cljs-repl)
Figwheel Controls:                                                                                                                                 
          (stop-autobuild)                ;; stops Figwheel autobuilder                                                              
          (start-autobuild id ...)        ;; starts autobuilder focused on optional ids                                        
          (switch-to-build id ...)        ;; switches autobuilder to different build                                              
          (reset-autobuild)               ;; stops, cleans, and starts autobuilder                                               
          (reload-config)                 ;; reloads build config and resets autobuild                                          
          (build-once id ...)             ;; builds source one time                                                                      
          (clean-builds id ..)            ;; deletes compiled cljs target files                                                       
          (print-config id ...)           ;; prints out build configurations                                                            
          (fig-status)                    ;; displays current state of system                                                           
          (figwheel.client/set-autoload false)    ;; will turn autoloading off                                                   
          (figwheel.client/set-repl-pprint false) ;; will turn pretty printing off                                                
  Switch REPL build focus:                                                                                                                     
          :cljs/quit                      ;; allows you to switch REPL to another build                                           
    Docs: (doc function-name-here)                                                                                                         
    Exit: :cljs/quit                                                                                                                                     
 Results: Stored in vars *1, *2, *3, *e holds last exception object

Prompt will show when Figwheel connects to your application

socksy12:04:51

which is all very fine, but it never connects

socksy12:04:03

which I suspect is because I see exactly the same in the terminal repl

socksy12:04:21

which does connect to the browser successfully

socksy12:04:38

how can I get the one in the nREPL connection to work successfully?

socksy12:04:27

i realise that lein repl is the recommended way to go these days, but 1) that will probably break other people’s flows in the company and 2) i can’t get it to work anyway for the same reason (I could ignore 1. if i could just write a new script to launch the repl instead)

socksy14:04:17

for what it’s worth, this is the error I have with lein repl

179   :cljsbuild {:builds {:app   {:source-paths ["src/app"  
        ^---  Map is missing required key: :cljsbuild

socksy15:04:30

it would be nice to be able to check the spec manually to see if there’s something in there that’s not validating. A plain old lein new figwheel foo works fine