Fork me on GitHub
#figwheel-main
<
2022-09-12
>
jrychter10:09:14

I'm migrating a large project from figwheel to figwheel-main. Still a very, very long way to go, but I have a question: figwheel-main seems to start on its own, plugging itself into "lein repl" somehow (not sure how). But I would like to prevent it from doing that: I want to start the clj REPL, and then start figwheel-main through the API (figwheel.main.api/start), with the full configuration supplied there. How do I prevent it from starting sooner than that?

Jan K12:09:08

@jrychter It doesn't start on its own for me (when doing "lein repl"). You can try with the demo project: https://github.com/bhauman/flappy-bird-demo-new

jrychter13:09:35

Hmm, that's intriguing. Indeed it doesn't start in the flappy-bird-demo-new project, but it does for me. I have to figure out what in project.clj might cause it to start.

jrychter13:09:19

Got it! Rather silly: it was a :init entry in :repl-options elsewhere in project.clj.

jrychter13:09:06

Moving forward, I think, but…

[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 5.266 seconds.
[Figwheel] Watching paths: ("src/cljs" "src/cljc" "env/dev/cljs" "test/cljc") to compile build - dev
[Figwheel:SEVERE] Can't obtain class com.sun.jna.Pointer
Execution error (ExceptionInInitializerError) at com.sun.jna.Native/initIDs (Native.java:-2).
Exception java.lang.UnsatisfiedLinkError: Can't obtain class com.sun.jna.Pointer [in thread "nREPL-session-f7636e87-9d5b-4fc7-9d6d-815e5b1c9053"]

seancorfield14:09:58

M1 Mac, perhaps? Are you using the latest version of figwheel-main? The file watcher was updated a while back to avoid problems on various OS/chipsets with the legacy file watcher @jrychter

jrychter14:09:41

Yes, M1 Mac, but this particular problem went away, I think when I removed this line :nrepl-middleware [cider.piggieback/wrap-cljs-repl]

seancorfield14:09:15

Cool. Glad you got it figured out.

jrychter14:09:40

The insistence on pre-defined output paths is causing me major headaches… It's going to be even more work than I thought to migrate to figwheel-main.

jrychter15:09:39

Sigh. Something takes the :output-dir option of the ClojureScript compiler and uses that relative path as the absolute web path when creating the toplevel app.js.

jrychter16:09:28

Well, I can't figure out this directory/path confusion, and I am unable to convince the tools to work anywhere else than the default paths (in "target/public"). I worked around it by doing some creative symlinking in my outer Makefile.