Share your thoughts in the 2024 State of Clojure Survey!

Welcome! Please see the About page for a little more info on how this works.

0 votes
in ClojureScript by

When compiling a file with :

clj -Sdeps '{:paths ["src"] :deps {org.clojure/clojurescript {:mvn/version "1.11.121"}}}' -M -m cljs.main -co '{:main org.foo.myscript}' --compile

the compilation will work fine, but if after that you run cljs.main --repl the browser repl will start, but evaluating forms on it will not work since evaluation will never finish.

This exact same commands work fine in 1.11.60.

After some debugging the issue seems to be caused by the current compiler never adding

document.write('<script>goog.require("clojure.browser.repl.preload");</script>'); 

to the resulting js file.

This is caused by :

https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/closure.clj#L2500-L2501

not adding the preload because :browser-repl isn't true.

The breaking change comes from this line:

https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/cli.clj#L498

which removes :browser-repl from the options because we are just compiling and there is no repl involved.

Looks like the behavior was explicitly changed by this commit :

https://github.com/clojure/clojurescript/commit/9c01d9b0a70ada1cb17cf3ce65ae93d76d0d3b08

Reverting the commit fixes the issue.

1 Answer

0 votes
by
selected by
 
Best answer

Thanks reverted - to be honest no longer sure of the rationale of the original change - tracking again in the original issue - https://clojure.atlassian.net/browse/CLJS-3383

...