I have this CLJC namespace and it fails to load on the CLJ side:
(ns ui.components
(:require [com.fulcrologic.fulcro.dom :as dom]))
(dom/div :.x "A")
I get error:
:cause "No such var: com.fulcrologic.fulcro.dom/macro-create-element*",
:via [{:type clojure.lang.Compiler$CompilerException,
See book. DOM macros are heavily optimized, and you need a conditional require on DOM…there’s a dom-server and dom. One is for CLJS, the other for CLJ.
thanks
Just a heads up:
#?(:clj [com.fulcrologic.fulcro.dom-server :as dom]
:cljs [com.fulcrologic.fulcro.dom :as dom])
breaks cljfmt, apparently they cannot handle reader conditionalsIntelliJ formats it fine…I thought I was getting it from cljfmt as well. I had AI copy out my intellij settings so it could use them:
{;; Formatting options matching IntelliJ/Cursive settings
;; Always use 2 spaces for indentation (equivalent to "Default to Only Indent")
;; This applies [:inner 0] to all forms, giving consistent 2-space indentation
:indents ^:replace {#".*" [[:inner 0]]}
;; Align map keys and values in columns (experimental feature)
;; Example: {:key-one value-1
;; :key-two value-2}
:align-map-columns? true
;; Standard formatting options
:indentation? true
:remove-surrounding-whitespace? true
:remove-trailing-whitespace? true
:insert-missing-whitespace? true
:remove-consecutive-blank-lines? false
;; Note: For binding alignment in let/binding forms, there is an :align-associative?
;; option, but it uses an older fork of cljfmt and has known bugs. If you need this
;; feature, you can add:
;; :align-associative? true
;; However, this may cause issues with some forms and lacks recent cljfmt updates.
;; Reader conditionals (#?) are formatted automatically by cljfmt
}I ended up mapping dom alias statically to the fulcro’s full namespace
this works in this case because it’s unlikely that anything in my codebase will use dom