ClojureScript

REPL Options

ClojureScript REPLs can take nearly all the same options that can be supplied to cljs.closure/build, for details see Compiler Options. This page documents additional supported options.

General Options

:analyze-path

Sets a source path to analyze upon REPL initialization so that, if it connects to an already-running JavaScript environment, symbols for any previously loaded namespaces are available. May also be set to a vector of paths to analyze.

:analyze-path "src"

:def-emits-var

Sets whether def (and derived) forms evaluated at the REPL return either a Var (if set to true) or the def init value (if false). Only affects forms evaluated at the REPL; compiled source behaves as if set to false. Default is true.

:def-emits-var false

:repl-requires

Specifies a set of lib specs (per the require REPL special) to be automatically loaded when launching a REPL. Defaults to specs that refer doc etc. along with pp.

:repl-requires ['[cljs.repl :refer-macros [source doc find-doc apropos dir pst]]
                '[cljs.pprint :refer [pprint] :refer-macros [pp]]]

:repl-verbose

Enable verbose reporting for the REPL. Useful for debugging. Defaults to false.

:repl-verbose true

This prints the compiled JavaScript before printing its evaluation:

cljs.user=> (+ 1 2)
((1) + (2))
3

:watch

Watch a source directory for recompilation to avoid spinning up an additional JVM.

:watch "src"

:watch-fn

:watch-fn (fn [] (println "built!"))

A function of no arguments to run after a successful build.

Browser REPL Options

These options are only applicable to the browser REPL that ships with ClojureScript.

:launch-browser

By default, starting the browser REPL launches the default browser configured with your operating system to connect back to it. You can disable this behavior by setting this option to false, and when doing so you will be prompted to connect with a message like

Waiting for browser to connect to http://localhost:9000 ...
:launch-browser false

:working-dir

The directory where the compiled REPL client JavaScript will be stored. Defaults to ".repl" with a ClojureScript version suffix, eg. ".repl-1.9-946".

:static-dir

List of directories to search for static content. Defaults to ["." "out/"].

:src

The source directory containing user-defined cljs files. Used to support reflection. Defaults to "src/".

Node REPL Options

:host

The host that the Node subprocess listens on for REPL traffic.

:host "localhost"

:port

The port that the Node subprocess listens on for REPL traffic.

:port 49152