Fork me on GitHub

@sfyire Your test-macro is being defined and being used in the same namespace. (What you are seeing here would occur with regular ClojureScript as well, FWIW.)


@mfikes,this is exactly what I was looking for! Thanks!


is it possible to include macros in AOT compilation?


i’m compiling with :aot-cache set to true and calling cljs.js/load-analysis-cache! at runtime for every .*cache.json file produced. this has dramatically sped up page load times and seems to make eval work for everything except macros.


after loading the AOT cache and trying to call a macro that intended to be loaded from cache, I get the following error:

 #error {:message "Could not eval ",
         :data {:tag :cljs/analysis-error},
         :cause #error {:message nil,
                        :data {:clojure.error/source nil,
                               :clojure.error/line 1,
                               :clojure.error/column 1,
                        :cause #error {
                                       :message "Cannot read property 'findInternedVar' of null at line 1 ",
                                       :data {
                                              :file nil,
                                              :line 1,
                                              :column 1,
                                       :cause #object[TypeError TypeError : Cannot read property 'findInternedVar' of null]}}}}


@sfyire While :aot-cache won't affect anything related to self-host (it is really for JVM ClojureScript), you can indeed conceptually AoT compile macro namespaces. You have to roll your own way of doing that. Planck does this The high-level idea is that you can use a build-time self-hosted compiler to compile macros namespaces down to JavaScript. Also Replete does this as well, all in the name of fast loading. So, you can look at Plank and Replete as inspiration on how to do this. There might be other examples out there as well.


I’ll check it out. thanks for the help and your work on clojurescript 🙂