figwheel-main

figwheel-main http://figwheel.org
DrLjótsson 2020-06-22T09:59:18.353200Z

I'm trying to figure out how to get a proper clojurescript repl running in Cursive using piggieback. But I can't get it to work. I've followed the advise on https://whynotsoftware.github.io/Migrating-From-Lein-Figwheel-To-Figwheel-Main/

DrLjótsson 2020-06-22T09:59:38.353500Z

I get this error message

DrLjótsson 2020-06-22T09:59:38.353700Z

Execution error (ExceptionInfo) at figwheel.main/nrepl-repl (main.cljc:1527). Failed to launch Figwheel CLJS REPL: nREPL connection found but unable to load piggieback. This is commonly caused by A) not providing piggieback as a dependency and/or B) not adding piggieback middleware into your nrepl middleware chain. Please see the documentation for piggieback here https://github.com/clojure-emacs/piggieback#installation Note: Cider will inject this config into your project.clj. This can cause confusion when your are not using Cider.

DrLjótsson 2020-06-22T10:03:44.355400Z

I have included [cider/piggieback "0.5.0"] as a dev dependency, [cider/cider-nrepl "0.25.2"] as a plugin and added :nrepl-middleware [cider.piggieback/wrap-cljs-repl] to :repl-options

DrLjótsson 2020-06-22T10:03:53.355800Z

Anyone have an idea?

dominicm 2020-06-22T13:19:15.355900Z

@brjann how did you start your repl?

DrLjótsson 2020-06-22T17:44:44.358200Z

This is an existing server-side project that I've added cljs to. So I alredy have a nREPL running that I access as a remote REPL using the run command.

DrLjótsson 2020-06-22T17:45:50.359Z

It is from this repl that i tried to run (require '[figwheel.main.api :as f]) (f/start {:mode :serve} "dev") (f/cljs-repl "dev")

DrLjótsson 2020-06-22T17:45:53.359200Z

The last command fails

DrLjótsson 2020-06-22T17:47:29.360500Z

TBH I don't really understand what I am doing. For the minute I start figwheel from the terminal using lein fig -- --build dev --repl

bhauman 2020-06-22T17:48:13.361600Z

you need to follow the instructions as provided in that article

DrLjótsson 2020-06-22T17:48:32.362Z

The migrating article?

bhauman 2020-06-22T17:48:35.362200Z

yes

bhauman 2020-06-22T17:48:40.362400Z

it uses lein repl

bhauman 2020-06-22T17:48:49.362700Z

to start nREPL

bhauman 2020-06-22T17:49:17.363300Z

which includes the piggiback middleware

DrLjótsson 2020-06-22T17:49:27.363700Z

Oh, and the cursive repl does not?

bhauman 2020-06-22T17:50:24.364400Z

apparently not?

DrLjótsson 2020-06-22T17:50:36.364900Z

I guess not...

bhauman 2020-06-22T17:50:48.365300Z

you should also change the :init to you startup code for figwheel

DrLjótsson 2020-06-22T17:54:07.366600Z

Ok, now I have it running in the terminal! But can I add it "within" Cursive, with syntax highlighting and stuff?

DrLjótsson 2020-06-22T17:57:06.366900Z

Oh wait

DrLjótsson 2020-06-22T18:02:37.367600Z

It works!

DrLjótsson 2020-06-22T18:04:20.369300Z

However, it's not using the figwheel config that I intended. In my figwheel-main.edn i have :watch-dirs ["src/cljs" "src/cljc" "test/cljs"] and :open-url false , which works fine when I run lein fig -- --build dev --repl

DrLjótsson 2020-06-22T18:04:54.369800Z

But (f/start {:mode :serve} "dev") gives this output

DrLjótsson 2020-06-22T18:04:55.370Z

user=> (f/start {:mode :serve} "dev") [Figwheel] Validating figwheel-main.edn [Figwheel] figwheel-main.edn is valid \(ツ)/ [Figwheel] Compiling build dev to "target/public/js/main.js" [Figwheel] Successfully compiled build dev to "target/public/js/main.js" in 4.967 seconds. [Figwheel] Outputting main file: target/public/js/main-auto-testing.js [Figwheel] Watching paths: ("src/cljs") to compile build - dev [Figwheel] Starting Server at http://localhost:9500 Opening URL http://localhost:9500

DrLjótsson 2020-06-22T18:05:17.370500Z

So it's not watching the right directories and opens the URL. What am I missing?

DrLjótsson 2020-06-22T18:06:02.370900Z

Also, the port should be 2020, not 9500

DrLjótsson 2020-06-22T18:13:52.371800Z

Oh, maybe {:mode :serve} replaces the figwheel-main.edn?

2020-06-22T18:17:24.373900Z

Hello everyone, I'm running on windows10 (therefore, Leiningen) and trying to connect to the NodeJS reply, using the devtools. The REPL setup works fine for the browser build, however it seems I'm making some mistake with the NodeJS repl config. Here's my setup

2020-06-22T18:18:26.374600Z

I'd be happy to test things out wrt windows and update the docs as indicated here https://github.com/bhauman/figwheel-main/issues/250

DrLjótsson 2020-06-22T18:20:44.375400Z

@bhauman: I got it working now. You were right, follow the instructions... Thank you!

👍 1
bhauman 2020-06-22T18:23:37.376100Z

@abhi18av yes I will definitely take a PR if you figure this out

bhauman 2020-06-22T18:24:11.376800Z

I’m not on windows so … it’s tough for me, I’m always looking for folks to take on windows support

2020-06-22T18:44:05.377900Z

@bhauman - Cool 👍 Just to confirm, did you notice anything odd in the config at all?

2020-06-22T18:45:00.378600Z

I've tried the lein fig:nodejs on the terminal as well - no luck

2020-06-22T18:45:28.379100Z

Is there any example, gist I could take a hint from?