This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-11-23
Channels
- # announcements (66)
- # babashka (41)
- # beginners (93)
- # calva (10)
- # cider (2)
- # clj-kondo (112)
- # cljs-dev (6)
- # cljsrn (1)
- # clojure (44)
- # clojure-dev (10)
- # clojure-europe (35)
- # clojure-italy (15)
- # clojure-nl (3)
- # clojure-uk (2)
- # clojurescript (38)
- # conjure (1)
- # datalevin (1)
- # datomic (16)
- # deps-new (4)
- # events (7)
- # figwheel-main (1)
- # fulcro (59)
- # graalvm (21)
- # integrant (3)
- # introduce-yourself (8)
- # jobs-discuss (2)
- # malli (23)
- # membrane (11)
- # membrane-term (2)
- # missionary (17)
- # off-topic (7)
- # pathom (23)
- # pedestal (6)
- # polylith (7)
- # portal (25)
- # releases (1)
- # remote-jobs (3)
- # reveal (5)
- # shadow-cljs (43)
- # spacemacs (7)
- # sql (18)
- # tools-deps (33)
- # vim (10)
- # xtdb (36)
@swiseman108 when using lein to manage dependencies you need to make sure you are using the correct versions of everything. so make sure you are using the proper versions for the shadow-cljs version you are using. I do not have any issues with the closure compiler and I don't have guava at all either
I think part of what I’m trying to figure out is how we’d be able to know which dependencies to use. Previously I’d be able to see the dep tree of shadow. But since shadow moved to a newer version of the closure-compiler (that no longer lists external deps), it’s near impossible to figure out which deps may conflict with the closure-compiler (as we saw with guava).
i.e a lein deps :tree
now shows zero dependencies under closure-compiler-unshaded. However, the closure compiler code can and will still conflict with other dependencies in your project. Just as we saw by pulling in guava 16.
I’m also somewhat new to this, so I could be misunderstanding something key here 🙂
yeah the closure compiler is a bit weird in that area. their bundling methods sometimes look like they don't expect people to use the closure compiler like we do 😛
see the dependencies listed here https://clojars.org/thheller/shadow-cljs
or as I always recommend let shadow-cljs.edn manage your dependencies. you only gain headaches by mixing your CLJ dependencies with CLJS ones
Thanks @thheller. Moving to shadow-cljs.edn for dep management is definitely in the plans. Separating out frontend and backend deps would also be a solution to this particular issue as the lower version of guava is only in the dependency tree of a backend dependency.
Hi there, running into an issue with cljs hot-reloading and trying to identify the point of failure using shadow's verbose output. I have three namespaces a
> b
> c
, with a macro defined by b
. So far hot reloading a
seems to work though changing a
does not seem to reload transitive dependency c
(which seems odd, but maybe there's some optimized decisions or something). However, if I introduce an additional dependency between c
and a
, changing a
reloads c
before b
, which is confusing to me: c
relies on the macro in b
, and results in an undefined var warning. Are my expectations about what gets reloaded and when, off? Let me know if it would help to post a simplified version the actual requires.
@zalky namespace reload always works by reloading the namespace that was modified plus all namespaces that have a direct require for it. nothing else by default.
reload order should happen in dependency order but I don't quite follow your description. macros are kind of tricky since they can technically do everything, so without an actual example I can't say much
@thheller, thanks, I think I see. So a really simplified version of what it looks like is the following:
(ns p.a)
(defn f
[])
(ns p.b) ; .clj
(defmacro macro
[]
'(p.a/f))
(ns p.b ; .cljs
(:require [p.a])
(:require-macros [p.b]))
(ns p.c
(:require [p.a] ; <-- this line causes p.c to be compiled before p.b
[p.b]))
(p.b/macro)
incorrect. that line causes p.c
to be compiled at all when p.a
is changed. without that it won't
but why is that a problem in the first place? is the macro doing some side effecting stuff that is causing a problem?
That's fair, they can be. This particular macro just produces some runtime code inside component render functions. I don't think it does any compile time side-effects. Do you know what part of the system, shadow or the cljs compiler, that does the dependency graph resolution? ie: resolves the dependency order?
fwiw I took your example code and things compile in the expected order (ie. modify a compiles a->b->c)
Ok, much appreciated, the actual code is part of a fairly large framework, and I wasn't immediately clear that only immediate dependents are recompiled. I think actual example has another namespace between p.a
and p.b
, and so p.b
is not actually being reloaded in either case.
the reasoning behind only recompiling direct dependents is that in theory thats the only namespaces that can "break". macros kinda break that assumption in certain cases so absolutely possible that things behave weirdly but most of the time that is due to macros doing some side-effecty stuff looking at analyzer data or so
Ah, hmm, the macros is indeed looking at &env
to determine if a particular symbol is a bound local
It does not call resolve, it just looks up whether a symbol is locally defined, and if it is not, provides a default binding.
Can I also ask, during the compilation, I'm seeing output like the following:
1:49:52 PM cljs.1 | -> Compile CLJS: a.cljs
1:49:52 PM cljs.1 | -> Compile CLJS: c.cljs
1:49:52 PM cljs.1 | <- Compile CLJS: c.cljs
...
1:49:52 PM cljs.1 | <- Compile CLJS: a.cljsi
Where c
depends transitively on a
. Does it mean these compilation steps are an asynchronous process? Are there any concurrency concerns here that might produce an undefined var error?there are multiple threads compiling yes. I still won't comment any further without an actual reproducible example. guessing here is really pointless.
Ok, understandable. I don't suppose there are any options in shadow to make that compilation synchronous? I didn't see anything in the docs, just thought I'd check.
Ok, thanks, I'll see where I can get with that, maybe I can get a simple repro. Very much appreciate you taking the time to provide some pointers.
@thheller, I put together a small https://github.com/zalky/shadow-repro. As best I can tell, it seems to me like a concurrency issue when it comes to macro compilation and transitive dependencies between recompiled namespaces. Let me know if I may have missed anything or could provide anything else that might be useful.
I have a question on polylith builds (so multiple deps.edn projects with :local/root dependencies. Could it be that shadow-cljs does not pick up the deps.cljs of multiple projects in this case? So I have to create ONE big deps.cljs file. I assume that shadow-cljs is looking only into JARS, and since the local deps are FILES, it will not find them inside a jar. I have not noticed a similar behavior when using JAR dependencies on clojars for exampel.