kentcdodds / babel-plugin-macros

🎣 Allows you to build simple compile-time libraries
https://npm.im/babel-plugin-macros
MIT License
2.62k stars 135 forks source link

How to handle nests macro #173

Open s97712 opened 3 years ago

s97712 commented 3 years ago

Relevant code or config

macro1(macro2("1 + 1"))

How to process macro2 first and then macro1 I try to adjust import order, but macro1 is always processed first.

kentcdodds commented 3 years ago

I believe they should run in the order they are imported in the file

conartist6 commented 3 years ago

I believe that happens since the macro code is called in the visitor for each import/require declaration.

Would you mind sharing your real use case? babel-plugin-macros has never supported that pattern very well but so far most people don't seem to be running into the limitation.