You need to have the
cljs.env/*compiler* binding bound (eg. via
cljs.env/with-compiler-env) and the relevant namespaces already analyzed (eg.
I don't know the exact sequence of things you need to do but in essence you are just missing the compiler env (which is not the same as the env passed into the macroexpand call itself).