figwheel-main

figwheel-main http://figwheel.org
PB 2019-07-10T01:00:45.028700Z

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 either

dpsutton 2019-07-10T01:03:14.029400Z

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

PB 2019-07-10T01:03:49.029900Z

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

PB 2019-07-10T01:05:43.030600Z

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

PB 2019-07-10T01:05:53.030900Z

I am booting using deps.edn though

dpsutton 2019-07-10T01:06:38.031500Z

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

dpsutton 2019-07-10T01:06:50.031800Z

don't know where example would come from though

PB 2019-07-10T01:08:04.032300Z

I see nothing:

kvlt@trve [19:07:12] [~/workspace/myapp/src/cljs] [feature/depsedn *]
-&gt; % ag "figwheel"
myapp/meow.cljs
1:(ns ^:figwheel-no-load myapp.meow

PB 2019-07-10T01:10:25.032800Z

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

dpsutton 2019-07-10T01:11:35.033500Z

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

dpsutton 2019-07-10T01:11:44.033800Z

(as far as i can tell)

PB 2019-07-10T01:11:50.034Z

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

dpsutton 2019-07-10T01:13:28.034300Z

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

PB 2019-07-10T01:13:40.034700Z

I thoguht as much 😕

dpsutton 2019-07-10T01:14:07.035Z

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

PB 2019-07-10T01:14:54.035400Z

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)

PB 2019-07-10T01:15:03.035600Z

I'm not sure if that is significant

dpsutton 2019-07-10T01:16:28.035900Z

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

dpsutton 2019-07-10T01:16:58.036500Z

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

dpsutton 2019-07-10T01:20:27.036900Z

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

PB 2019-07-10T01:31:25.037500Z

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

dpsutton 2019-07-10T01:35:20.038100Z

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

dpsutton 2019-07-10T01:36:27.038500Z

https://github.com/bhauman/figwheel-main#quick-way-to-understand-the-command-line-options check the output-to and output-dir settings

dpsutton 2019-07-10T01:41:04.038900Z

this should mimic the cljsbuild compiler options from project.clj

PB 2019-07-10T02:30:23.039700Z

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

dpsutton 2019-07-10T02:54:51.040300Z

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

dpsutton 2019-07-10T02:55:24.041Z

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