If anything is unclear with what I’m trying to do above, let me know! 🙂
@martinklepsch you likely need to add this call so the goog deps are added to your compiler env https://github.com/clojure/clojurescript/blob/f021e99f2fab0069967ed134eecdf4be3b05958c/src/main/clojure/cljs/closure.clj#L2963
although that should be done by default I think
oh no wait .. you are using this incorrectly
yeah, that’s most likely correct 😄
(defn- analyze-file [file]
(let [opts (-> {:foreign-libs [{:file "lib/fl.js"
:provides ["react"]}]}
(cljs.closure/add-implicit-options))
state (cljs.env/default-compiler-env opts)]
(cljs.env/with-compiler-env state
(ana/no-warn
(cljs.closure/validate-opts opts)
(ana/analyze-file file opts)))
state))
I think that should be right
although you likely don't want to re-create the compiler env for every file you analyze
I should shut up .. you probably have ana
as cljs.analyzer.api
in which case you code was correct
I blindly assumed cljs.analyzer
as ana
That still seems to fail to find the goog.obj namespace. Interestingly it doesn’t fail to find goog.object
but goog.obj
which is the alias used in one of the files being analyzed
There’s a tiny bit more context here: https://github.com/lread/cljdoc-analyzer/pull/6
goog.obj
is not part of the closure lib?
you mean the file is using (:require [goog.object :as goog.obj])
?
Oh my, it seems that the jar actually contains a namespace that requires goog.obj
(i.e. has a typo)