Skip to content

Commit d12d678

Browse files
committed
CLJS-1182: semantics of load-file should be require + implicit :reload
1 parent 5b847b9 commit d12d678

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/clj/cljs/closure.clj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1582,7 +1582,7 @@ should contain the source for the given namespace name."
15821582

15831583
(defn ^String src-file->goog-require
15841584
([src] (src-file->goog-require src {:wrap true}))
1585-
([src {:keys [wrap all-provides :as options]}]
1585+
([src {:keys [wrap all-provides] :as options}]
15861586
(let [goog-ns
15871587
(case (util/ext src)
15881588
"cljs" (comp/munge (:ns (ana/parse-ns src)))
@@ -1592,7 +1592,9 @@ should contain the source for the given namespace name."
15921592
(IllegalArgumentException.
15931593
(str "Can't create goog.require expression for " src))))]
15941594
(if (and (not all-provides) wrap)
1595-
(str "goog.require(\"" goog-ns "\");")
1595+
(if (:reload options)
1596+
(str "goog.require(\"" goog-ns "\", true);")
1597+
(str "goog.require(\"" goog-ns "\");"))
15961598
(if (vector? goog-ns)
15971599
goog-ns
15981600
(str goog-ns))))))

src/clj/cljs/repl.clj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,8 @@
497497
;; but a bit annoying here
498498
(ana/analyze-file src opts)
499499
(-evaluate repl-env f 1 (cljsc/add-dep-string opts compiled))
500-
(-evaluate repl-env f 1 (cljsc/src-file->goog-require src)))
500+
(-evaluate repl-env f 1
501+
(cljsc/src-file->goog-require src {:wrap true :reload true})))
501502
(binding [ana/*cljs-ns* ana/*cljs-ns*]
502503
(let [res (if (= File/separatorChar (first f)) f (io/resource f))]
503504
(assert res (str "Can't find " f " in classpath"))

0 commit comments

Comments
 (0)