Skip to content

Commit fe021c1

Browse files
committed
CLJS-2657: cljs.main: Watch causing compilation errors with -r
Address both reported issues. The first is handled by simply deferring to existing watch support in the REPL. The other of options embedding compile-env in options is avoided by binding it instead. REPL were recently changed to check to see if cljs.env/*compiler* is bound and to reuse.
1 parent b1dc91b commit fe021c1

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

src/main/clojure/cljs/cli.clj

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -434,16 +434,15 @@ present"
434434
repl? (boolean (#{"-r" "--repl"} (first args)))
435435
serve? (boolean (#{"-s" "--serve"} (first args)))
436436
cenv (env/default-compiler-env)]
437-
(if-let [path (:watch opts)]
438-
(if repl?
439-
(.start (Thread. #(watch-proc cenv path opts)))
440-
(build/watch path opts cenv))
441-
(build/build source opts cenv))
442-
(when repl?
443-
(repl-opt repl-env args
444-
(assoc-in cfg [:options :compiler-env] cenv)))
445-
(when serve?
446-
(serve-opt repl-env args cfg))))
437+
(env/with-compiler-env cenv
438+
(if-let [path (:watch opts)]
439+
(when-not repl?
440+
(build/watch path opts cenv))
441+
(build/build source opts cenv))
442+
(when repl?
443+
(repl-opt repl-env args cfg))
444+
(when serve?
445+
(serve-opt repl-env args cfg)))))
447446

448447
(defn- compile-opt
449448
[repl-env [_ ns & args] cfg]

0 commit comments

Comments
 (0)