lein-figwheel

socksy 2019-04-10T12:27:45.008300Z

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.

socksy 2019-04-10T12:28:40.009200Z

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

socksy 2019-04-10T12:30:02.010400Z

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

socksy 2019-04-10T12:31:30.012300Z

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

socksy 2019-04-10T12:32:26.012800Z

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

socksy 2019-04-10T12:33:48.013400Z

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

socksy 2019-04-10T12:35:51.013700Z

which is all very fine, but it never connects

socksy 2019-04-10T12:36:03.014100Z

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

socksy 2019-04-10T12:36:21.014400Z

which does connect to the browser successfully

socksy 2019-04-10T12:36:38.014800Z

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

socksy 2019-04-10T12:39:27.016300Z

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)

socksy 2019-04-10T14:29:17.017Z

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

socksy 2019-04-10T15:36:30.017600Z

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