Fork me on GitHub

@thheller Is there an issue around anonymous functions in CLJS/shadow-cljs? When I execute (fn [foo] foo) it returns the following stack trace:


SyntaxError: Unexpected token .
    at eval (<anonymous>)
    at Object.shadow$cljs$devtools$client$browser$global_eval [as global_eval] ()
    at Object.shadow$cljs$devtools$client$env$repl_call [as repl_call] ()
    at Object.shadow$cljs$devtools$client$browser$repl_invoke [as repl_invoke] ()
    at shadow$cljs$devtools$client$browser$handle_message ()
    at Object.shadow$cljs$devtools$client$env$process_next_BANG_ [as process_next_BANG_] ()
    at Object.shadow$cljs$devtools$client$env$process_ws_msg [as process_ws_msg] ()
    at WebSocket.<anonymous> ()


However, calling (fn foo-fn [foo] foo) seems to work as expected


nothing that I know of but I'll look into it


there is indeed something buggy going on. wonder why that happens though


it is trying to eval (function cljs$user$cljs.user.cljs(foo){\r\nreturn foo;\r\n}) which is invalid JS


fixed in 2.8.45. was only causes by anon-fns defined directly in the REPL, not nested ones. guess thats why nobody complained about that before


Nice, thanks for fixing so quickly! Really appreciate it - I"ll verify it shortly


running into this on the command line.. ideas?

shadow-cljs release app
shadow-cljs - config: /Users/den/Dropbox/dev/code/zeal/shadow-cljs.edn  cli version: 2.8.42  node: v8.11.1
shadow-cljs - connected to server
Execution error (ClassNotFoundException) at (


what version of java are you using?


@U050CJFRU how did you start the server? if you are starting the server in a custom embedded way and intent on using the command line you need to require shadow.cljs.devtools.cli wherever you start the server


@thheller ah! 💡💡💡. I started it embedded but wanted to build from the command line. Ended up building from the REPL (embedded as well) so it all worked out in the end. good to know, thanks!


Short: Is there a way to supply additional :dependencies for a build? as with clj's :extra-deps Long: In a shadow-cljs project, I'm having two build aliases, which are being used as

shadow-cljs watch local
shadow-cljs release prod
I'm using re-frisk as a dependency, How would I include re-frisk as dependency only for :local build? i.e. not include it in :prod


are you looking to add dev dependencies?


I use something like below:

 :dependencies [[re-frisk "version"]]
  {:target :browser
   :devtools {:preloads [[re-frisk.preload]]}}
   :dev {:extra-paths ["src/test" "src/dev" "src/workspaces"]
         :extra-deps {
                        nubank/workspaces {:mvn/version "1.0.9"},
                        binaryage/devtools {:mvn/version "0.9.10"}
               {:mvn/version "0.4.1"}
               {:mvn/version "0.5.1"}

  {:target :browser}}


I also use deps.edn to define that :dev like:

{:paths [...]
 :deps {;actual deps here
:aliases {:dev {:extra-paths [...]
                        :extra-deps {...}
` and in shadow-cljs.edn :
{:deps {:aliases [:dev]}
 :builds {:local ...}} 


instead of dependencies in the shadow-cljs.edn file


yea, I am curious how to have a dependency in the run-time of a build, cool that we've got this smart inference of deps-in-use


@brownmoose3q it doesn't matter if re-frisk is on the classpath or not. it is only included in a build if the build uses it. its presence on the classpath is not relevant


a neat feature, eases dev's life 👍


ha.. My mind was seeking for the solution, ability to supply an extra dep, filtering other approaches The spot in the doc about inferring deps-in-use jumps in your eyes straight away. 🙂


:preloads are only used in development builds so it automatically won't be included in the release build

Daniel Leong20:08:29

Is there a way to get compile warnings/errors via nrepl? With figwheel when I use the load-file op it responds with err messages (ex: {'id': '874b6a4f-5419-4acc-3f82-bdca8708ac7d', 'session': 'acf389b9-51cb-4231-8499-1a9ee17fa53d', 'err': 'WARNING: No such namespace: str, could not locate str.cljs, str.cljc, or JavaScript source providing "str" at line 24 /path/to/file.cljs^@'}) but shadow-cljs just responds with a {'status': ['done'] ...} message


errors are reported to whereever the watch was started. did you maybe not start the watch via nrepl in the first place?

Daniel Leong20:08:45

Ah, no I usually start the watch via cli and connect to nrepl via vim/fireplace

Daniel Leong20:08:59

I tried starting the watch over nrepl by evaluating the (shadow/watch :app) API but load-file still just returns ['done']

Daniel Leong20:08:31

I used shadow-cljs start to start a background server, if that makes a difference

Daniel Leong20:08:16

To be clear, the CLI (if I do shadow-cljs watch :app) and the webpage (via the HUD/overlay) both report the errors just fine, but I was hoping to also get them via the nrepl connection for displaying in Vim


please open an issue. too tired to look into it now. could be that load-file errors just aren't properly forwarded to all places

Daniel Leong20:08:55

Will do, thanks!