This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-08-07
Channels
- # aleph (4)
- # announcements (7)
- # arachne (1)
- # beginners (138)
- # calva (5)
- # cider (1)
- # clara (14)
- # clj-kondo (1)
- # cljsrn (2)
- # clojars (4)
- # clojure (247)
- # clojure-dev (33)
- # clojure-europe (3)
- # clojure-italy (71)
- # clojure-losangeles (6)
- # clojure-romania (6)
- # clojure-spain (11)
- # clojure-uk (17)
- # clojurescript (95)
- # core-async (2)
- # cursive (19)
- # datomic (7)
- # duct (27)
- # figwheel (1)
- # graalvm (22)
- # juxt (7)
- # kaocha (8)
- # leiningen (1)
- # luminus (7)
- # lumo (4)
- # off-topic (38)
- # reagent (4)
- # reitit (11)
- # shadow-cljs (30)
- # spacemacs (42)
- # tools-deps (103)
- # xtdb (5)
@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
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
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> ()
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
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 java.net.URLClassLoader/findClass (URLClassLoader.java:381).
shadow.cljs.devtools.cli
@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
I use something like below:
{:builds
:dependencies [[re-frisk "version"]]
{:local
{: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"}
day8.re-frame/re-frame-10x {:mvn/version "0.4.1"}
day8.re-frame/tracing {:mvn/version "0.5.1"}
}
}
:prod
{: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 ...}}
...
}
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 https://shadow-cljs.github.io/docs/UsersGuide.html#_clojure_script
@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. 🙂 https://shadow-cljs.github.io/docs/UsersGuide.html#_clojure_script
:preloads
are only used in development builds so it automatically won't be included in the release build
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?
Ah, no I usually start the watch via cli and connect to nrepl via vim/fireplace
I tried starting the watch over nrepl by evaluating the (shadow/watch :app)
API but load-file
still just returns ['done']
I used shadow-cljs start
to start a background server, if that makes a difference
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
Will do, thanks!