Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error when calling macro referencing a qualified js symbol from a $default namespace #312

Closed
ikappaki opened this issue Feb 25, 2023 · 2 comments

Comments

@ikappaki
Copy link
Contributor

ikappaki commented Feb 25, 2023

version

v1.2.168

platform

win11

problem

error when calling a macro referencing a $default namespace symbol:
Could not resolve symbol: nbb.internal.moment$default/now

repro

  1. Create nbb.edn
{:paths ["src"]}
  1. initalize node project and install moment
npm init

npm i moment
  1. Create a src/macros.cljs to test $default namespace calls
(ns macros
  (:require ["moment$default" :as mmt]))

(.now mmt)
;; => 1677315062961

;; (issue.case 1) Can't call instance method on $default namespace
;;
(defmacro mm-1 []
  `(.now mmt))
#_(mm-1)
;; => Could not find instance method: now
(macroexpand-1 '(mm-1))
;; => (.now "nbb.internal.moment$default")

(mmt/now)
;; => 1677315113666

;; (issue.case 2) Neither can call fn on $default namespace
(defmacro mm-2 []
  `(mmt/now))
#_(mm-2)
;; => Could not resolve symbol: nbb.internal.moment$default/now
(macroexpand-1 '(mm-2))
;; => (nbb.internal.moment$default/now)
  1. Notice the two cases it fails to call a fn from that namespace.

expected behavior

Should be able to use the $default namespace in macros as any other js library namespace.

Thanks,

(this is a follow up from #311)

@borkdude
Copy link
Collaborator

Fixed in 1.2.169

@ikappaki
Copy link
Contributor Author

Thanks a lot! it works like a charm now 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants