Possible to use macros in a node target?

I’ve been using shadow-cljs to emit code for use with Firebase Functions (which is like AWS Lambda).

Today I wondered, Can I use macros? I’ve never written a macro before. My first question is, Is this possible?

Then if it is possible: how do I require the cljc file in my function’s cljs file?

Any other important clues would be appreciated.

It turns out to be trivial. For those interested:

  • Define your macro in a cljc file. UPDATE: a clj file.
  • Then in your ClojureScript code, us the ns construct :require-macros.

I don’t recommend using .cljc files since they make things much more complicated IMHO.

See my post about macros, applies to any CLJS target.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.