Puzzled... reload after figwheel compile fails, manual refresh works ok

clojurescript

#1

This one has got me scratching my head. I have a clojurescript/re-frame/electron project running. So far it is fairly basic, I’m just working on getting all the various pieces to play nicely together. At some point the automatic refresh stopped working. I didn’t notice at first because the compile was working fine. It wasn’t until I started to wonder why I was having to refresh the electron window manually when figwheel ought to be doing it for me that I realised something was amiss and had a look at the console and found the error.

I have ruled out emacs/cider. It does the same from lein figwheel. So… before I tear it all down and start again (again), has anyone seen an error like this before? This is what appears in the js console when the figwheel triggered reload tries to run:

ioc_helpers.cljs:42 Uncaught TypeError: goog.net.jsloader.load is not a function
at figwheel$client$file_reloading$reload_file_in_html_env (file_reloading.cljs:208)
at figwheel$client$file_reloading$reload_file (file_reloading.cljs:250)
at figwheel$client$file_reloading$blocking_load (file_reloading.cljs:269)
at file_reloading.cljs:279
at file_reloading.cljs:277
at figwheel$client$file_reloading$state_machine__12212__auto____1 (file_reloading.cljs:277)
at figwheel$client$file_reloading$state_machine__12212__auto__ (file_reloading.cljs:277)
at cljs$core$async$impl$ioc_helpers$run_state_machine (ioc_helpers.cljs:35)
at cljs$core$async$impl$ioc_helpers$run_state_machine_wrapped (ioc_helpers.cljs:39)
at ioc_helpers.cljs:48

#2

I have run into issues like this before, where Figwheel (and other live reload tools, including CodeKit, BrowserSync, and LiveReload) fails to auto-reload the page, or reloads the page at the wrong time (eg: it races with the compiler or filesystem). Not sure if I’ve ever hit this exact issue, but I feel like I’ve seen that error message, though it would have been about 3 years ago.

My solutions were not good — either I just start reloading the page manually, or switch to a different means of reloading, or burn it all down and build up again until I find the moment when the error begins so I can figure out how to work around it.

Sorry. Good luck!


#3

If you use git you may find git bisect useful to find the moment in time it started failing.


#4

Thanks guys.
I can see git bisect coming in handy in the future. Probably overkill for this as there isn’t any code I want to save. Gonna start over and this time keep a close eye on reloading as I go.


#5

goog.net.jsloader.load was removed from recent Google Closure-library version. You need at least Figwheel 0.5.13 for recent ClojureScript versions.



#6

It seems to be working now with figwheel 0.5.11 and clojurescript 1.10.64. I will upgrade anyway, might as well have the latest version…


#7