Fork me on GitHub
#figwheel-main
<
2019-07-10
>
PB01:07:45

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 '' 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 either

dpsutton01:07:14

interesting. figwheel-ws isn't anywhere in the figwheel-main repo but i see it in lein-figwheel

PB01:07:49

Interesting... I wonder where it is getting that from

PB01:07:43

lein-figwheel isn't in my deps.edn, however it is in the project.clj :S

PB01:07:53

I am booting using deps.edn though

dpsutton01:07:38

grep for figwheel in the frontend? possible your dev front end reaches out on its own?

dpsutton01:07:50

don't know where example would come from though

PB01:07:04

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

PB01:07:25

Doesn't ws refer to websocket? Does figwheel-main not use websockets?

dpsutton01:07:35

it does but not at an endpoint with figwheel-ws in it

dpsutton01:07:44

(as far as i can tell)

PB01:07:50

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 
[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 
user> 
everything looks normal except that it does not have cljs.user and has user instead

dpsutton01:07:28

that's a clj repl that will become a cljs repl when you connect to the frontend

PB01:07:40

I thoguht as much 😕

dpsutton01:07:07

and you go to localhost:9500 and see that error?

PB01:07:54

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)

PB01:07:03

I'm not sure if that is significant

dpsutton01:07:28

that's super significant. that's you not having a cljs application

dpsutton01:07:58

so your page is saying load the js from js/main.js and that's not where your compiler is putting it

dpsutton01:07:27

location of your js: public/cljs-out/dev-main.js but you're asking for it at js/main.js

PB01:07:25

Ok. That does sound rather important. Would that be a figwheel-main.edn config?

dpsutton01:07:20

those are compiler settings. i think you want to put those in your dev.cljs.edn file

dpsutton01:07:04

this should mimic the cljsbuild compiler options from project.clj

PB02:07:23

OK huge improvement. The repl is connecting, but it's connecting to localhost:9500 rather than my app

dpsutton02:07:51

Figwheel main is compiling and serving your app. It is your app

dpsutton02:07:24

If you need to serve your app from your backend look into the docs for how to do that