bhauman / lein-figwheel

Figwheel builds your ClojureScript code and hot loads it into the browser as you are coding!
Eclipse Public License 1.0
2.88k stars 210 forks source link

Can get the nrepl session establshed #751

Closed ghost closed 2 years ago

ghost commented 2 years ago

Hi,

I used to have this code to bootstrap figwheel (0.5.17) in dev:

_(ns ^:figwheel-no-load dev.dev (:require [dev.data-fixture :as fix] ... [tv-remittances.console.frontend.ui.console :as cons] [devtools.core :as devtools] [figwheel.client :as figwheel :include-macros true]) (:require-macros ...))

(def initial-serverless-state {...})

(enable-console-print!) (devtools/install! [:formatters :hints])

(figwheel/watch-and-reload :websocket-url "ws://localhost:3450/figwheel-ws" :jsload-callback cons/mount-root)

(if-let [node (.getElementById js/document "console")] (do (cons/init! :dev) (println "Loaded dev") ))_

Now with 0.5.20, I get stuck after the page loads using the above code. I jump directly to the above console name space w/o going through that dev.dev dispatcher. I removed it entirely like in the hello world project but get the same behavior:

lprefontaine@lprefontaine-laptop:~/wrk/tv-remittances-console$ lein figwheel Figwheel: Cutting some fruit, just a sec ... Figwheel: Validating the configuration found in project.clj Figwheel: Configuration Valid ;) Figwheel: Starting server at http://0.0.0.0:3449 Figwheel: Watching build - dev Figwheel: Cleaning build - dev Compiling build :dev to "resources/public/js/compiled/tv-remittances-console.js" from ["env" "src" "../tv-remittances/src" "../connectit-services/src"]... ... logback msgs... Successfully compiled build :dev to "resources/public/js/compiled/tv-remittances-console.js" in 19.963 seconds. Figwheel: Starting CSS Watcher for paths ["resources/public/css"] Figwheel: Starting nREPL server on port: 7888 Launching ClojureScript REPL for build: dev 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 [Rebel readline] Type :repl/help for online help info

And it says stuck there after my page load which succeeds (I get the default console panel, etc). I also get figwheel compilation errors. But no nrepl. I tried to revert to the config I used under 0.5.17 but hit a couple of nasty exceptions.

In the browser I never seen attempts to establish a web socket connection with the figewheel server. I assume it blocks there and that prevents the nrepl to start. But it's unclear to me what are the initial steps involved and where it could fail.

I looked in the code of the start function and there's a test as follow:

(when-not (nil? goog/dependencies) ..._

The same test is also present in 0.5.17. And if that fails, nothing seems to gets initialized on the client side. I need some trails to follow, so far I spent half a day tweaking the project config and trying to shrink this to a minimum. And I still didn't wrap my head around this.

Suggestions ?

Thank you

ghost commented 2 years ago

Solved it. In my initial configuration all the cljsbuild stuff was wrapped in profiles. By looking at more recent use (reagent, ...) I saw that these things were split. Applied the recipe and it worked. Must have been some config options overwritten. Hard to tell what but now it's much more clean. Closing this.