Skip to content

Commit

Permalink
DE cljc ns require temporary fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ggeoffrey committed Aug 7, 2024
1 parent 43a0b10 commit 465517a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/hyperfiddle/electric/impl/cljs_analyzer2.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 465517a

Please sign in to comment.