Closed davidyang closed 7 months ago
@davidyang Hi David,
Could you please clarify what you're actually trying to do?
I'm not familiar with shadow.cljs.devtools.api
, so any context you can provide would be helpful.
I've pushed Encore ~v3.100.1
~ v3.100.2
which fixes an incorrect assumption (that cljs.analyzer.api
will always be present).
I'm not sure I fully understand exactly what you're trying to do though, so hopefully this is sufficient in your case. If not, please let me know what issue you're still seeing with ~v3.100.1
~ v3.100.2
.
[For reference] Note extra context from here:
hey all - I’m trying to compile from the API (so that I can do a single jack-in using Calva) but if my user ns requires taoensso.timbre, then shadow-cljs throws an error trying to compile taoensso.encore. If I use the same aliases but don’t include the
(ns user)
from the alias then shadow can compile.
Update: please use v3.100.2
, not v3.100.1
.
Hi @ptaoussanis - v3.100.2
fixed the issue - thanks so much!
Let me do my best to explain the situation:
I don't think I'm trying to do anything strange with shadow (seems pretty standard to have the Shadow compiler run in the same JVM as the web server app if you're working on both):
server
and browser
deps. clojure -A:browser:browser-dev -M -m shadow.cljs.devtools.clj watch browser-dev
to compile my CLJS sources, it's able to compile encore.cljc
clojure -A:server:server-dev:browser:browser-dev -M -m shadow.cljs.devtools.clj watch browser-dev
AND taoensso.encore
is required (which it was in (ns user)
of the server
aliases' extra-paths
) then the shadow compile fails.My impression briefly looking at the source code is that encore
has two ways to detect that it's being compiled by CLJS (both the reader conditional and through &env
) and if it's required in the JVM portion AND then later compiled by shadow-cljs
there's some state that gets mixed up. Otherwise I don't really understand why cljs.analyzer.api
wouldn't be available in the shadow
compile. Just a guess though...
I've included my deps.edn
and shadow-cljs.edn
here https://gist.github.com/davidyang/c0d186e7b52713c2de56a12b91f424ac
Thanks again for your help!
You're welcome, thanks for the extra context 👍
encore has two ways to detect that it's being compiled by CLJS (both the reader conditional and through &env)
In case you're wondering why - these serve different purposes. &env
is checked when generating macros that target Cljs, since reader conditionals aren't helpful in that case.
If I start up a JVM clojure with
and then try to do a
I get this error. If I empty out (ns user) then the shadow build completes successfully.