Fork me on GitHub
#shadow-cljs
<
2021-09-21
>
Oliver George00:09:55

Newbie question. I want to do some interactive development so I'm running shadow-cljs watch server app but I think I want to turn off hot reloading because I'm setting local vars to aid debugging and they are lost when the namespace reloads.

Oliver George00:09:16

(I'm using comments in the namespace to prepare sexprs to send to the repl)

Oliver George00:09:43

I can see that I could add metadata to the namespace to say "hands off" but is there a way to tell the file watcher to stop watching.

Oliver George00:09:00

I tried shadow-cljs compile server app but it wasn't happy.

Fredrik Andersson00:09:04

put the local vars in a defonce atom

Oliver George00:09:25

Can you stop the watcher?

Fredrik Andersson00:09:49

you don't need to if you put the vars in a defonce

Oliver George00:09:12

That's not particuarly convienient for what I'm doing

Fredrik Andersson00:09:22

like (defonce my-locals (atom { })

Oliver George00:09:29

e.g. set db var then execute part of an existing fn which exects a local var

Oliver George00:09:38

I see it would work as a workaround though. Thanks.

Fredrik Andersson00:09:51

im not sure why it's a work around

Fredrik Andersson00:09:04

that IS the way as far as I understand

Fredrik Andersson00:09:23

so that you can keep the repl alive

Oliver George00:09:02

Okay, thanks. I'll give that a try. (also ^:dev/once will get me where I want to go)

Oliver George00:09:31

Just curious for the repl command. There was one for figwheel called stop-autobuild.

Fredrik Andersson00:09:02

yes, but why would you want to turn it off? thats basically clojure killer feature

Fredrik Andersson00:09:31

isolate your state to a an atom

Fredrik Andersson00:09:11

np, I'm new to clojure too

Fredrik Andersson00:09:54

just created a simple textfile parser, no state 😄

Oliver George00:09:19

wait till you play with instaparse... you'll feel like a god!

thheller05:09:44

@olivergeorge there is (shadow.cljs.devtools.api/watch-set-autobuild! :the-build-id false) to stop the automatic rebuild or you can set :devtools {:autoload false} in your build config to still run the automatic watch rebuild but not automatically load it

thheller05:09:39

you can also start the watch from the CLJ REPL with (shadow.cljs.devtools.api/watch :the-build-id {:autobuild false})

Oliver George06:09:03

Thanks 🙂

🙌 2
Michaël Salihi20:09:02

Hi @thheller, I remember a discussion about a Shadow-cljs build-hook for parse/write in index.html I think. Can you refresh my memory about the name please?

Benjamin C23:09:18

Is there anything special you need to do to get shadow-cljs to work with a https://stackoverflow.com/questions/14381898/local-dependency-in-package-json/14387210#14387210? I've checked the project directory after installing the local package, and it created a symlink under npm_modules to the local module on my disk.

Benjamin C23:09:11

But when I try to require the file, it says the required JS dependency is not available .