# Possible to use macros in a node target?

**URL:** https://clojureverse.org/t/possible-to-use-macros-in-a-node-target/9801
**Category:** Troubleshooting
**Tags:** shadow-cljs
**Created:** [February 21, 2023, 12:00am UTC](https://clojureverse.org/t/possible-to-use-macros-in-a-node-target/9801 "2023-02-21T00:00:43Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![rmschindler](https://clojureverse.org/user_avatar/clojureverse.org/rmschindler/32/3638_2.png) [@rmschindler](https://clojureverse.org/u/rmschindler)
#### Post date: [February 21, 2023, 12:00am UTC](https://clojureverse.org/t/possible-to-use-macros-in-a-node-target/9801/1 "2023-02-21T00:00:43Z")

</div>

I’ve been using [shadow-cljs](https://github.com/thheller/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.

---

<div class="post-metadata">

### Author: ![rmschindler](https://clojureverse.org/user_avatar/clojureverse.org/rmschindler/32/3638_2.png) [@rmschindler](https://clojureverse.org/u/rmschindler)
#### Post date: [February 21, 2023, 6:29am UTC](https://clojureverse.org/t/possible-to-use-macros-in-a-node-target/9801/2 "2023-02-21T06:29:00Z")

</div>

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`.

---

<div class="post-metadata">

### Author: ![thheller](https://clojureverse.org/user_avatar/clojureverse.org/thheller/32/534_2.png) [@thheller](https://clojureverse.org/u/thheller)
#### Post date: [February 21, 2023, 7:04am UTC](https://clojureverse.org/t/possible-to-use-macros-in-a-node-target/9801/3 "2023-02-21T07:04:31Z")

</div>

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.

> **[ClojureScript Macros](https://code.thheller.com/blog/shadow-cljs/2019/10/12/clojurescript-macros.html)**
>
> ClojureScript Macros are a hurdle for most CLJS beginners and wrapping your head around how they work can be quite confusing. I’ll try to cover the basics yo...

---

<div class="post-metadata">

### Author: ![system](https://clojureverse.org/uploads/default/original/2X/5/51079bf9e4b7d9466242c06cf1e43b9f8bd6da14.png) [@system](https://clojureverse.org/u/system)
#### Post date: [August 22, 2023, 7:05pm UTC](https://clojureverse.org/t/possible-to-use-macros-in-a-node-target/9801/4 "2023-08-22T19:05:27Z")

</div>

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