Skip to content

Commit 7751a39

Browse files
author
dnolen
committed
temporary fix to the process JS modules issue at the REPL
1 parent 2239b4b commit 7751a39

1 file changed

Lines changed: 19 additions & 15 deletions

File tree

src/main/clojure/cljs/repl.cljc

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -817,6 +817,8 @@
817817
(catch Throwable e
818818
(caught e repl-env opts)
819819
opts))))
820+
;; TODO: consider alternative ways to deal with JS module processing at REPL
821+
opts' opts ;; need to save opts prior to JS module processing for watch
820822
opts (if (or (:libs opts) (:foreign-libs opts))
821823
(let [opts (cljsc/process-js-modules opts)]
822824
(swap! env/*compiler* assoc :js-dependency-index (deps/js-dependency-index opts))
@@ -863,21 +865,23 @@
863865
(init)
864866
(catch Throwable e
865867
(caught e repl-env opts)))
866-
(when-let [src (:watch opts)]
867-
(.start
868-
(Thread.
869-
((ns-resolve 'clojure.core 'binding-conveyor-fn)
870-
(fn []
871-
(let [log-file (io/file (util/output-directory opts) "watch.log")]
872-
(err-out (println "Watch compilation log available at:" (str log-file)))
873-
(try
874-
(let [log-out (FileWriter. log-file)]
875-
(binding [*err* log-out
876-
*out* log-out]
877-
(cljsc/watch src (dissoc opts :watch)
878-
env/*compiler* done?)))
879-
(catch Throwable e
880-
(caught e repl-env opts)))))))))
868+
;; TODO: consider alternative ways to deal with JS module processing at REPL
869+
(let [opts opts'] ;; use opts prior to JS module processing
870+
(when-let [src (:watch opts)]
871+
(.start
872+
(Thread.
873+
((ns-resolve 'clojure.core 'binding-conveyor-fn)
874+
(fn []
875+
(let [log-file (io/file (util/output-directory opts) "watch.log")]
876+
(err-out (println "Watch compilation log available at:" (str log-file)))
877+
(try
878+
(let [log-out (FileWriter. log-file)]
879+
(binding [*err* log-out
880+
*out* log-out]
881+
(cljsc/watch src (dissoc opts :watch)
882+
env/*compiler* done?)))
883+
(catch Throwable e
884+
(caught e repl-env opts))))))))))
881885
;; let any setup async messages flush
882886
(Thread/sleep 50)
883887
(binding [*in* (if (true? (:source-map-inline opts))

0 commit comments

Comments
 (0)