Skip to content

Commit 9100030

Browse files
mfikesswannodette
authored andcommitted
CLJS-2298: REPLs should automatically load user.(cljs|cljc) files at root of Java classpath
1 parent 6512df8 commit 9100030

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/main/clojure/cljs/repl.cljc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -953,6 +953,9 @@
953953
(:require ~@repl-requires))
954954
{:line 1 :column 1})
955955
identity opts)))
956+
maybe-load-user-file #(when-let [user-resource (util/ns->source 'user)]
957+
(when (= "file" (.getProtocol ^URL user-resource))
958+
(load-file repl-env (io/file user-resource) opts)))
956959
read-eval-print
957960
(fn []
958961
(let [input (binding [*ns* (create-ns ana/*cljs-ns*)
@@ -983,6 +986,7 @@
983986
(analyze-source analyze-path opts)))
984987
(init)
985988
(run-inits repl-env inits)
989+
(maybe-load-user-file)
986990
(catch Throwable e
987991
(caught e repl-env opts)))
988992
(when-let [src (:watch opts)]

0 commit comments

Comments
 (0)