From 465517aedc125ee28489016024389c168f665fc5 Mon Sep 17 00:00:00 2001 From: Geoffrey Gaillard Date: Wed, 7 Aug 2024 11:28:22 +0200 Subject: [PATCH] DE cljc ns require temporary fix --- src/hyperfiddle/electric/impl/cljs_analyzer2.clj | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/hyperfiddle/electric/impl/cljs_analyzer2.clj b/src/hyperfiddle/electric/impl/cljs_analyzer2.clj index d15cfcc7f..d1bab9a75 100644 --- a/src/hyperfiddle/electric/impl/cljs_analyzer2.clj +++ b/src/hyperfiddle/electric/impl/cljs_analyzer2.clj @@ -35,7 +35,10 @@ ;; since shadow-cljs compiles in parallel we need to serialize the requires (when-not (get (loaded-libs) sym) (try (#'clojure.core/serialized-require sym) ; try bc it can be cljs file - (catch java.io.FileNotFoundException _)))) + (catch java.io.FileNotFoundException _) + (catch Throwable t ; HACK temporary fix. Electric tries to load `.cljc` files assuming it contains clojure code, but fails for cljc files only targeting multip cljs targets (e.g. nextjournal.clojure-mode.util targets :squint + :cljs) + ; Ignoring the failed require seems harmless. Log to keep an eye on it and detect more failing cases. + (print `safe-require "Electric failed to load ns for" sym ":" (ex-message t)))))) (defn find-ns-var [^clojure.lang.Namespace nso sym] (.findInternedVar nso sym)) (declare find-var find-macro-var)