Skip to content

Commit 0dad6a2

Browse files
Deraenswannodette
authored andcommitted
CLJS-2691: goog.require in module-processed files shouldn't require goog.base
Using goog.require or `import x from "goog:something"` adds goog base into module requires, but because Cljs already adds goog base file to build always, this causes duplicate file error in optimize step.
1 parent 3265705 commit 0dad6a2

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/main/clojure/cljs/closure.clj

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1735,9 +1735,13 @@
17351735
;; https://github.com/google/closure-compiler/pull/2641
17361736
(str
17371737
"goog.provide(\"" module-name "\");\n"
1738-
(apply str (map (fn [n]
1739-
(str "goog.require(\"" n "\");\n"))
1740-
(.getRequires input)))
1738+
(->> (.getRequires input)
1739+
;; If CJS/ES6 module uses goog.require, goog is added to requires
1740+
;; but this would cause problems with Cljs.
1741+
(remove #{"goog"})
1742+
(map (fn [n]
1743+
(str "goog.require(\"" n "\");\n")))
1744+
(apply str))
17411745
(.toSource closure-compiler ast-root)))))
17421746

17431747
(defn- package-json-entries

0 commit comments

Comments
 (0)