Hey all. I've gone through the really painful journey of migrating from lein -> deps.edn. This included moving from figwheel-sidecar to figwheel-main. I have everything working with the exception of the repl integration with cider (the ui loads as I would expect). It appears that my websocket connection fails in my console with the followin gmessage:
socket.cljs?rel=1562357436120:71 WebSocket connection to '<ws://localhost:3449/figwheel-ws/example>' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
You may notice its trying to connect to example
? This is odd as i have a file named dev.cljs.edn
.
My config is incredibly simple atm:
;; dev.cljs.edn
{:main myapp.meow}
;; myapp.meow
(ns ^:figwheel-no-load myapp.meow
(:require [myapp.core :as core]
[devtools.core :as devtools]
[cljs.spec.test.alpha :as stest]))
(prn "doing it meow")
(enable-console-print!)
(devtools/install!)
(core/init!)
(stest/instrument)
I curiously do not see the printline eitherinteresting. figwheel-ws isn't anywhere in the figwheel-main repo but i see it in lein-figwheel
Interesting... I wonder where it is getting that from
lein-figwheel isn't in my deps.edn, however it is in the project.clj :S
I am booting using deps.edn though
grep for figwheel in the frontend? possible your dev front end reaches out on its own?
don't know where example
would come from though
I see nothing:
kvlt@trve [19:07:12] [~/workspace/myapp/src/cljs] [feature/depsedn *]
-> % ag "figwheel"
myapp/meow.cljs
1:(ns ^:figwheel-no-load myapp.meow
Doesn't ws
refer to websocket? Does figwheel-main not use websockets?
it does but not at an endpoint with figwheel-ws
in it
(as far as i can tell)
This is also super weird:
[Figwheel] Validating figwheel-main.edn
[Figwheel] figwheel-main.edn is valid \(ツ)/
[Figwheel] Compiling build dev to "target/public/cljs-out/dev-main.js"
[Figwheel] Successfully compiled build dev to "target/public/cljs-out/dev-main.js" in 28.511 seconds.
[Figwheel] Watching paths: ("src/cljs") to compile build - dev
[Figwheel] Starting Server at <http://localhost:9500>
[Figwheel] Starting REPL
Prompt will show when REPL connects to evaluation environment (i.e. a REPL hosting webpage)
Figwheel Main Controls:
(figwheel.main/stop-builds id ...) ;; stops Figwheel autobuilder for ids
(figwheel.main/start-builds id ...) ;; starts autobuilder focused on ids
(figwheel.main/reset) ;; stops, cleans, reloads config, and starts autobuilder
(figwheel.main/build-once id ...) ;; builds source one time
(figwheel.main/clean id ...) ;; deletes compiled cljs target files
(figwheel.main/status) ;; displays current state of system
Figwheel REPL Controls:
(figwheel.repl/conns) ;; displays the current connections
(figwheel.repl/focus session-name) ;; choose which session name to focus on
In the cljs.user ns, controls can be called without ns ie. (conns) instead of (figwheel.repl/conns)
Docs: (doc function-name-here)
Exit: :cljs/quit
Results: Stored in vars *1, *2, *3, *e holds last exception object
Opening URL <http://localhost:9500>
user>
everything looks normal except that it does not have cljs.user
and has user
insteadthat's a clj repl that will become a cljs repl when you connect to the frontend
I thoguht as much 😕
and you go to localhost:9500 and see that error?
That seems to load with the text "debux test". Only console error is: GET http://localhost:9500/js/main.js net::ERR_ABORTED 404 (Not Found)
I'm not sure if that is significant
that's super significant. that's you not having a cljs application
so your page is saying load the js from js/main.js and that's not where your compiler is putting it
location of your js: public/cljs-out/dev-main.js but you're asking for it at js/main.js
Ok. That does sound rather important. Would that be a figwheel-main.edn config?
those are compiler settings. i think you want to put those in your dev.cljs.edn file
https://github.com/bhauman/figwheel-main#quick-way-to-understand-the-command-line-options check the output-to and output-dir settings
this should mimic the cljsbuild compiler options from project.clj
OK huge improvement. The repl is connecting, but it's connecting to localhost:9500 rather than my app
Figwheel main is compiling and serving your app. It is your app
If you need to serve your app from your backend look into the docs for how to do that