Fork me on GitHub
#figwheel-main
<
2019-01-21
>
idiomancy21:01:29

with figwheel-main, do I need to include something in my figwheel-main.edn that indicates that it should actually perfom the hooks I have defined? I have an ns with ^:figwheel-hooks and a function with ^:after-load, but when it recompiles, it doesn't run those functions :/ interestingly, if I just put a call to the function in the namespace, it will call it as it re-evals the compiled js so I just drop a (-main) at the bottom of the main file seems a little primitive

dominicm21:01:39

@idiomancy I just came to ask a question about the figwheel hooks too. I have my hooks in main.cljs, and when I modify ajax.cljs, I see the figwheel spinner, but my after-load function is not called.

idiomancy21:01:17

well, as a workaround, you can just manually call the main function lol

dominicm21:01:00

Actually, I think my bug is unrelated. I'm not seeing [Figwheel] loaded (tutorial.moan.frontend.ajax), but I am seeing [Figwheel] loaded (tutorial.moan.frontend.main) in the logs. So I guess it's not loading the ns for some reason :thinking_face:

Braden Shepherdson21:01:14

try a lein clean? I've had weird problems like that if I've changed the namespace or restructured the project's directories.

dominicm21:01:10

I've seen this on 2 machines today, I'm assuming it's a problem with the environment I've created.

dominicm21:01:47

oh, and in 2 different projects. But could be possible, trying 🙂

dominicm21:01:51

No. Still no luck 😞

dominicm22:01:19

Hmm, poking at internals, I ran this comment tweaked to my project:

(let [compile-env (atom (first (vals @last-compiler-env)))]
    (binding [env/*compiler* compile-env]
      (paths->namespaces-to-reload [(.getCanonicalPath (io/file "src/tutorial/moan/frontend/ajax.cljs"))])

      ))
I notice that (:sources @env/*compiler*) only includes my main.cljs, not my ajax.cljs. And also that I get no results back.

dominicm22:01:04

Ah, that was the clue I needed 🙂 Looks like it's the result of having :build-inputs set to :main.

dominicm22:01:07

https://figwheel.org/docs/build_inputs.html I don't feel like this trade-off is mentioned here really. Is this intentional (and needs docs) or a bug?

👆 5