Shadow-cljs: (:require [goog.dom :as dom]) results in undeclared var

Created on 19 Nov 2019  路  4Comments  路  Source: thheller/shadow-cljs

I can't seem to find info in documentation, but this could be that I am searching poorly.

Is there a reason why the following results in an undeclared var?

(ns my.namespace
  (:require [goog.dom :as dom]))

It seems ok to use goog.dom/getElemet directly. Is there a relevant piece of documentation that could help me understand?

Thank you so much for shadow-cljs. It is fantastic.

I am currently using:

"shadow-cljs": "^2.8.69"

Most helpful comment

How far we've come! Thank you 馃檱

All 4 comments

Is there a reason why the following results in an undeclared var?

Do you mean the ns causes an undeclared var? You surely mean something else is causing that? What exactly did you use? (dom/getElement ...) should be fine?

I had a namespace like this:

(ns acme.widget
  (:require [cljs.core.async :refer [<! chan put!]]
                  [goog.dom :as dom]
                  [goog.events :as events])
  (:require-macros [cljs.core.async.macros :refer [go-loop]]))

And I was getting errors when referencing dom that it was undeclared. But I could use goog.dom/ directly. It was very strange.

I have since shutdown and restarted the repl and the problem appears to have gone away 馃し鈥嶁檪

I really appreciate the response, and am super grateful for your work on this project 馃檱

BTW in modern core.async you can just do

(ns acme.widget
  (:require [cljs.core.async :refer [<! chan put! go-loop]]
            [goog.dom :as dom]
            [goog.events :as events]))

No need for the :require-macros anymore :)

How far we've come! Thank you 馃檱

Was this page helpful?
0 / 5 - 0 ratings

Related issues

loganpowell picture loganpowell  路  9Comments

arichiardi picture arichiardi  路  11Comments

thheller picture thheller  路  6Comments

darwin picture darwin  路  6Comments

cark picture cark  路  8Comments