Skip to content

Commit

Permalink
add support :skip-goog-provide in ns meta
Browse files Browse the repository at this point in the history
In cljsjs shims for firebase the (ns firebase.app) declaration
was clashing with the firebase var it tries to export. The ns
is unused otherwise anyway so we can just skip emitting goog.provide
  • Loading branch information
thheller committed Aug 7, 2019
1 parent 098036f commit 678e5ad
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion project.clj
Expand Up @@ -82,7 +82,7 @@

;; experimental
[hawk "0.2.11"]
[thheller/shadow-cljsjs "0.0.18"]]
[thheller/shadow-cljsjs "0.0.19"]]

:source-paths
["src/main"]
Expand Down
5 changes: 3 additions & 2 deletions src/main/shadow/build/compiler.clj
Expand Up @@ -142,7 +142,6 @@
))))
ast)


(defn find-js-require-pass [env ast opts]
(when (and (= :invoke (:op ast))
;; js/require called at the REPL should not be added to metadata since it becomes sticky
Expand Down Expand Up @@ -289,7 +288,9 @@
;; FIXME: can't remove goog.require/goog.provide from goog sources easily
;; keeping them for CLJS for now although they are not needed in JS mode
#_(when (= :goog (get-in state [:build-options :module-format])))
(comp/emitln "goog.provide('" (comp/munge name) "');")

(when-not (get-in ast [:meta :skip-goog-provide])
(comp/emitln "goog.provide('" (comp/munge name) "');"))

(when (= name 'cljs.js)
;; this fixes the issue that cljs.js unconditionally attempts to load cljs.core$macros
Expand Down

0 comments on commit 678e5ad

Please sign in to comment.