Skip to content

Commit

Permalink
CLJS-1130: :foreign-libs regression under Closure optimized builds
Browse files Browse the repository at this point in the history
:foreign-libs support regressed, we never want to emit a goog.require
for a foreign lib in any other optimization setting other than :none

make the comment string clear on this point to avoid future simple
errors like this one.
  • Loading branch information
dnolen committed Mar 16, 2015
1 parent efec6f4 commit d94e6c6
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/clj/cljs/compiler.clj
Original file line number Diff line number Diff line change
Expand Up @@ -848,14 +848,18 @@
(emitln "if(!COMPILED) " loaded-libs " = cljs.core.set();"))
(doseq [lib (remove (set (vals seen)) (distinct (vals libs)))]
(cond
(and (= :nodejs (get-in @env/*compiler* [:options :target]))
(ana/foreign-dep? lib))
;; under node.js we load foreign libs globally
(let [{:keys [js-dependency-index options]} @env/*compiler*
ijs-url (get-in js-dependency-index [(name lib) :url])]
(emitln "cljs.core.load_file(\""
(str (io/file (util/output-directory options) (util/get-name ijs-url)))
"\");"))
(ana/foreign-dep? lib)
(let [{:keys [target optimizations]} (get @env/*compiler* :options)]
;; we only load foreign libraries under optimizations :none
(when (= :none optimizations)
(if (= :nodejs target)
;; under node.js we load foreign libs globally
(let [{:keys [js-dependency-index options]} @env/*compiler*
ijs-url (get-in js-dependency-index [(name lib) :url])]
(emitln "cljs.core.load_file(\""
(str (io/file (util/output-directory options) (util/get-name ijs-url)))
"\");"))
(emitln "goog.require('" (munge lib) "');"))))

(-> libs meta :reload)
(emitln "goog.require('" (munge lib) "', 'reload');")
Expand Down

0 comments on commit d94e6c6

Please sign in to comment.