@thheller shadow-cljs isn’t hot reloading files that aren’t found in src
path.
I have a deps.edn
file with :paths ["src", "resources", ".x/resources"]
and :deps true
in shadow. File watching, recompile and hot-reload work if I have the file in src
but not if the file is instead in resources
or .x/resources
. How do I fix that?
I’m starting the server and watch process in clojure using shadow.cljs.devtools.server/start!
and shadow.cljs.devtools.api/watch*
.
resources are filtered out since they not supposed to contain source files. this is currently not configurable since a lot of people put the output files into the resources folder and that causes issues for shadow-cljs if it thinks those are sources again
Thanks. I found the same issue with ".clam/src"
What alternative paths are allowed
.clam/src
should be fine unless the dir is hidden
Thanks. Ill try again. Might have been conflating issues
Excellent! Working! Is there a way to force hot-reloading further up the tree for specific namespaces? i.e. not just requiring namespaces
hmm?
:dev/always
in the ns forces a recompile every time but what do you mean by "further up the tree"?
so I have a case where x -requires-> y -requires-> z
. When z
changes I need to compute data with clojure and inject it into x
. Currently the way I’m doing it is, y
defs a var that evals a macro (which computes the data). Then x
has a :dev/after-load
hook which renders component defined in z
, computed in macro in y
. However, the require of y
in x
is stale when :dev/after-load
is called (I assume because of hot reloading doesnt traverse up the tree like figwheel), so I need to do some stuff where I defer using var via wrapped function.
I realise this is probably super confusing.
But I was asking whether when z
changes, which triggers y
to be reevaluated, I could make x
do the same, because I ’m assuming this would fix my issue?
It’s not super important since I got things working by creating a function that returns the function I want (in x
), its just a bit unclear why this is needed.
Adding :dev/always
fixes it!
I’m running shadow/watch
to compile + hot reload a bundle w/ a browser target and want a hook to run a shell script after the initial build. what’s the idiomatic way to do that in shadow?
:build-hooks
https://shadow-cljs.github.io/docs/UsersGuide.html#build-hooks
had seen this, but it looks like a build hook on a watch will be invoked on each rebuild if I’m reading that correctly. there’s no hook for just the first completed build at the moment, correct?
by the way, thanks for everything you do with shadow. absolutely lovely piece of technology
you can (assoc build-state ::work-done true)
and then check (::work-done build-state)
if you did what you intended to do
well opposite order but build-state will stay arround in watch
so you can store stuff in it between each cycle
make sure to use namespaced keys though to now clash with anything internal
perfect. thanks for the pointers