Fork me on GitHub

hey y'all, i'm running into a strange issue. I'm using reagent and re-frame, and I have a component from namespace.a that includes a component from namespace.b. However, namespace.b/component is returning nil , which is very strange. namespace.b is requiring D3 with (:require ["d3" :as d3]) . D3 has been added to my package.json


if I take out the d3 require, then everything loads fine


Also, this is only when the app initially loads. If I make a change and shadow reloads the page, then the namespace.b/component no longer evals to nil, and everything works ok


OK it looks like upgrading from shadow-cljs 2.8.something to 2.15.3 solved the problem 🎉


@nonrecursive always check the browser console. if the namespace fails to load for some reason it won't be available properly. browser console should tell you something at least

Quentin Le Guennec09:08:24

Hello, I have an issue with importing of a npm module in a cljc file in shadow-cljs:

------ ERROR -------------------------------------------------------------------
 File: /home/void/wp/crispeta/src/acme/web/ui/components.cljs
failed to require macro-ns "acme.web.utils.macros", it was required by "acme.web.ui.components"
Syntax error macroexpanding clojure.core/ns.
Call to clojure.core/ns did not conform to spec.
-- Syntax error -------------------

  (... (:require
        [camel-snake-kebab.core :as csk]
        ["semantic-ui-react" :as semantic-ui]))

has extra input

-- Relevant specs -------

   (clojure.spec.alpha/? clojure.core/string?)
   (clojure.spec.alpha/? clojure.core/map?)

Detected 1 error


you can't do the string require in clojure

Quentin Le Guennec09:08:49

So no macros using npm modules?


don't know what you mean by that


a macro runs in clojure so you cannot use them in the macro directly


you can however have the macro emit code that uses the npm module at runtime


don't know what your intent is

Quentin Le Guennec09:08:45

I think that'll work, yes