0
votes

I'm starting a cljs repl with a node.js environment.

=> clj -m cljs.main -re node

Documentation for using the repl says that you can place a user.cljs file at the classpath root for the project and it will be automatically loaded into a repl session in the cljs.user namespace.

I have a src directory with user.cljs at its base. The project's directory structure looks like the following.

xyz / deps.edn
    / src / xyz / core.cljs
          / user.cljs

ClojureScript version 1.10.520 is the only dependency in deps.edn.

Whenever I start the repl I get the following error.

Execution error (IllegalArgumentException) at cljs.closure/compile-file (closure.clj:639). /var/folders/rk/r65ng3n93l53h95nsvkl265c0000gn/T/out385499094487053918164582825852/cljs/user/user5D28A44.js is not a relative path

When I look in the temporary output folder it is clear that ../cljs/user/user5D28A44.js is not being generated.

Is this a cljs bug? Can someone show me an example of this working correctly?

2

2 Answers

0
votes

You have to start the ClojureScript repl explicitly from clojure programmatically, the command line startup short hand doesn't work for loading user.cljs.

=> clj
Clojure 1.10.1
user=> (require '[cljs.repl :as repl])
user=> (require '[cljs.repl.node :as node])
user=> (def env (node/repl-env))
user=> (repl/repl env)
cljs.user=> working?
"Yes."
cljs.user=> ...

With the working? symbol defined in user.cljs it is available as you would expect.

0
votes

It’s a known issue. See: CLJS-2917

You can work around it by specifying an output directory via -d.