Share your thoughts in the 2021 Clojure Community Survey!

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

0 votes
in ClojureScript by

https://clojurescript.org/guides/quick-start recommends the following command to make cljs.main wait for the browser to be manually started, but it causes cljs.main to exit without waiting for the browser to start.

clj --main cljs.main --compile hello-world.core --repl-options "{:launch-browser false}" --repl

To reproduce

clj -Srepro -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version "1.10.758"}}}' --main cljs.main --compile hello-world.core --repl-options "{:launch-browser false}" --repl

Expected Result

"Waiting for browser to connect to http://localhost:9000" is printed to the console.

Actual result

cljs.main exits without printing anything to the console.

Additional Info

The closest permutation of the original command I was able to find that works as expected is:

clj -Srepro -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version "1.10.758"}}}' --main cljs.main --repl-opts "{:launch-browser false}" --compile hello-world.core --repl
  1. --repl-options => --repl-opts
  2. moved --repl-options before --compile

Should the tutorial be updated?

Version info

empty$ cat /etc/fedora-release 
Fedora release 32 (Thirty Two)
empty$ clj -Sverbose </dev/null | grep version
version      = 1.10.1.536
empty$ java -version
openjdk version "1.8.0_252"
OpenJDK Runtime Environment (build 1.8.0_252-b09)
OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)

1 Answer

+1 vote
by
selected by
 
Best answer

Thanks for the report. The command in the Quick Start is indeed wrong. The correct command is:

clj --main cljs.main --repl-opts "{:launch-browser false}" --compile hello-world.core --repl

The website will be updated.

...