This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-04-01
Channels
- # announcements (54)
- # asami (3)
- # aws (5)
- # babashka (8)
- # beginners (64)
- # biff (27)
- # calva (11)
- # cider (41)
- # clj-otel (7)
- # cljdoc (72)
- # clojars (20)
- # clojure (159)
- # clojure-austin (3)
- # clojure-europe (143)
- # clojure-italy (1)
- # clojure-nl (5)
- # clojure-norway (3)
- # clojure-uk (3)
- # clojurescript (19)
- # community-development (1)
- # core-typed (5)
- # cursive (3)
- # datalevin (1)
- # datomic (8)
- # emacs (13)
- # fulcro (4)
- # google-cloud (4)
- # honeysql (25)
- # java (1)
- # jobs (1)
- # lambdaisland (3)
- # lsp (121)
- # off-topic (52)
- # other-languages (1)
- # re-frame (3)
- # releases (2)
- # remote-jobs (1)
- # shadow-cljs (36)
- # sql (4)
- # xtdb (36)
Can I run a cljs repl on target :npm-module ?
Also, If I run shadow-cljs watch :code
, get server + nrepl port, connect to it (in cursive, ,via port), run (shadow/repl :code)
I get No available JS runtime.
Any not sure how to procede.
Here is my shadow-cljs.end
{:source-paths ["src"]
:dependencies
[[binaryage/devtools "1.0.5"]]
:builds
{:code
{:target :npm-module
:output-dir "node_modules/shadow-cljs"
:entries [gbo.mycljs]}}}
:npm-module
can in theory have a REPL but it depends on how and where you are including the code. if another tools processes it too much it won't work. eg. webpack can work but also can break horribly đŸ˜›
for it to load you need to set a proper :runtime :browser
or :runtime :node
in the build config
and then include the devtools client ns from JS so if (process.env.NODE_ENV === "development") { require("shadow-cljs/shadow.cljs.devtools.client.browser") }
or so
@thheller any tips on hacking shadow-cljs? I'm feeling bad only asking/reporting issues and I want to know how could I try to fix them too đŸ™‚
thats kind of too general. what do you intend to work on? its just a clojure project like any other clojure project đŸ˜›
I usually add the shadow-cljs src/main
path to a project I'm working on. ie. keep the regular dependency and then just override it with local sources. then just poke at it from the REPL.
Yes, I think the idea of adding src/main
path could work đŸ™‚.
My problem is with react-native builds, somehow I see no stacktrace at all (only the munged function name). I was thinking if I could debug it and at least know what's wrong
It's this error: https://clojurians.slack.com/archives/C6N245JGG/p1648591534372839
The stacktrace appears, but no file (not even the JS one) or line number
this is not an error from shadow-cljs and nothing you do to shadow-cljs will change this error message?
It's not an error from shadow-cljs - it's just that when I use shadow-cljs with react native, and an error occurs on my code, I don't see the ClojureScript nor the Javascript (compiled) file, regardless of source-maps is disabled or enabled...
So I've been thinking if I could debug this issue somehow
hmm yeah dunno what your plan is. so can't provide tips. but there is nothing in shadow-cljs producing this stacktrace format. that is all in react-native/metro
maybe you can just try/catch this error in your code somewhere so you can get to it before metro mangles it?
Yeah, that's what I did: I did a (try (my-code) (catch :default e) (println (-stack e))
, and indeed the filename and row are missing
oh well I just remembered that metro didn't support merging input source maps a very long time ago. maybe it still doesn't? I don't really keep up to date with what react-native is doing. maybe something in that changed so that you now get no trace at all rather than a trace back to the JS?
Is there a way to get the current build state from a channel or some other async mechanism when running a build using (devtools.api/watch target {:autobuild false})
and (devtools.api/watch-compile! target)
? At the moment I’m using the build history coming from the server instance ref (`(get @(:state-ref (:build-history @devtools.server.runtime/instance-ref)) target)`) but if it’s possible to get it via a channel that would be nicer. I tried to use the :channels :output
channel coming from the worker state ref but subscribing to that seemed to cause some issues
what do you intend to do with this state? makes it easier to give suggestions on how to get it đŸ˜›
I need to know what the latest status that isn’t :compiling
is so I can see if the build succeeded or failed programmatically
I want to know if a build has succeeded or failed when run in watch mode, and I need to query for the status programmatically. The way described at the start works but I saw there are also async channels, so I wonder if I should use the method described there or if there is another way
it would really help to know WHERE you want to know it? like what kind of tool? the info is all available but without knowing a WHERE I cannot give a suggestions of which method to use
do you want to know it on the client side? do you want to know it in the JVM running shadow-cljs? do you want to know it over nrepl?
In the JVM, with a running server using the devtools server
so you are running it in embedded mode? via a user.clj
or so? or is that one started just via shadow-cljs server
or shadow-cljs watch ..
?
I guess so, I'm running it by calling devtools.server/start!
and then api/watch :target-name
ok, (sys-bus/sub (:system-bus @shadow.cljs.devtools.server.runtime/instance-ref) :shadow.cljs.model/worker-broadcast your-channel)
your-channel
being a core.async channel you create and read from. or close when done
[:shadow.cljs.model/worker-output build-id]
instead would just be the output for the specified build
Great, thanks!