Hi, it happens to me quite frequently (several times every day) that while doing changes in the code, Shadow-cljs REPL stops working correctly and I have to restart Shadow to make it working again.
For instance, I get the following in Cursive nREPL:
(clojure.string/join ["ab" "cd"])
Timeout while waiting for result.
And shadow-cljs outputs this into console:
[2020-12-16 16:07:58.625 - WARNING] :shadow.cljs.devtools.server.util/handle-ex - {:msg {:op :cljs-load-sources, :sources [[:shadow.build.classpath/resource "cljs/spec/gen/alpha.cljs"] [:shadow.build.classpath/resource "cljs/spec/alpha.cljs"] [:shadow.build.classpath/resource "cljs/repl.cljs"] [:shadow.cljs.repl/resource "cljs/user.cljs"]], :call-id 6, :from 71}}
ExceptionInfo no output for id: [:shadow.cljs.repl/resource "cljs/user.cljs"] {:resource-id [:shadow.cljs.repl/resource "cljs/user.cljs"]}
shadow.build.data/get-output! (data.clj:197)
shadow.build.data/get-output! (data.clj:193)
shadow.cljs.devtools.server.worker.impl/fn--15184/fn--15187 (impl.clj:813)
clojure.core/map/fn--5866 (core.clj:2753)
clojure.lang.LazySeq.sval (LazySeq.java:42)
clojure.lang.LazySeq.seq (LazySeq.java:51)
clojure.lang.RT.seq (RT.java:535)
clojure.core/seq--5402 (core.clj:137)
clojure.core.protocols/seq-reduce (protocols.clj:24)
clojure.core.protocols/fn--8146 (protocols.clj:75)
clojure.core.protocols/fn--8146 (protocols.clj:75)
clojure.core.protocols/fn--8088/G--8083--8101 (protocols.clj:13)
Any idea what could be causing this or how I could debug where is the problem?
Also, all previous requires are lost when this happens. So for instance, I run the following code before:
(require '[orgpad.client.db.get :as db-get])
=> nil
I can use functions from db-get perfectly fine. After this, I can't call them and I get this error in REPL:
------ WARNING - :undeclared-ns ------------------------------------------------
Resource: <eval>:1:2
No such namespace: db-get, could not locate db_get.cljs, db_get.cljc, or JavaScript source providing "db-get" (Please check that namespaces with dashes use underscores in the ClojureScript file name)
--------------------------------------------------------------------------------
------ WARNING - :undeclared-var -----------------------------------------------
Resource: <eval>:1:2
Use of undeclared Var db-get/latest-editor
--------------------------------------------------------------------------------
I have a client who wants to re-add limited IE11 support to an app. One technical problem is that we’re leaning on Vega for charting. Vega has switched over to a lot of spread / gather and arrow function syntax and relies on Symbols extensively. Am I understanding the shadow-cljs docs right that any npm dependencies it processes into the app bundle get ES5'd? Wondering if this is a reasonable enough way to get it to at least compile for loading into IE11. (I’m presuming there are still going to be runtime breakages that I can at least catch as exceptions and use to swap in a degraded UI).
@pavel.klavik which version? this should have been fixed a couple versions ago
@rgm the default is ES5 output so that should already work
Is this some kind of personal sorcery, or just what GCC does?
mostly GCC yes
Either way this beats heading into webpack/babel and foreign libs 🙏
well can't know for sure. sometimes some patterns aren't properly detected/polyfilled by GCC and need manual tuning
but most modern language features can be compiled down
@thheller It seems that I am already running the latest version:
shadow-cljs - config: C:\Shared\orgpad\shadow-cljs.edn
shadow-cljs - socket connect failed, server process dead?
NPM dependency "react" has installed version "^16.14.0"
"16.13.0" was required by jar:file:/C:/Users/pavel/.m2/repository/reagent/reagent/0.10.0/reagent-0.10.0.jar!/deps.cljs
NPM dependency "react-dom" has installed version "^16.14.0"
"16.13.0" was required by jar:file:/C:/Users/pavel/.m2/repository/reagent/reagent/0.10.0/reagent-0.10.0.jar!/deps.cljs
shadow-cljs - HTTP server available at <http://localhost:3500>
shadow-cljs - HTTP server available at <http://localhost:3600>
shadow-cljs - server version: 2.11.8 running at <http://localhost:9630>
shadow-cljs - nREPL server started on port 9000
shadow-cljs - watching build :client
But I updated anyway using npm install -g shadow-cljs
where I got
+ shadow-cljs@2.11.8
updated 1 package in 5.141s
server version: 2.11.8
looks fine yeah
I'm not sure what could be causing this. I was not able to reproduce it again after the last fix
would help to know what else is going on over the nrepl connection and at what point it starts failing
I am not able to find a reproducible way yet. It occurs several times per day to be quite annoying but not enough frequently to be easily reproducible. Is there some debugging I could run when it occurs?
I wrote a nrepl helper that logs all the messages back and forth, would help to have a dump from that
clj -m shadow.nrepl-debug 3000 3001
tunnels from port 3000 to port 3001
so clj -m shadow.nrepl-debug 9001 9000
would work if you then connect your editor to 9001 instead of 9000
Ok, I got that running\
what would you want to get when it fails? the console output, or the debug message is stored somewhere else?
it logs somewhere in target/nrepl-debug or so
the file would help
Ok, I actually got it failing right now, with
Connecting to remote nREPL server...
Clojure 1.10.1
(shadow/repl :client)
To quit, type: :cljs/quit
=> [:selected :client]
(+ 1 2)
Timeout while waiting for result.
(+ 1 2)
Timeout while waiting for result.
(+ 1 2)
Timeout while waiting for result.
thanks. I'll take a look
@pavel.klavik can't tell anything from the logs. this is a browser env right? is the browser maybe on a breakpoint in the debugger? break on uncaught exception or something? or js/alert? dunno why else it wouldn't respond to a simple eval
nothing like that, I was not using any debugger
the app was running fine
guess I'll add some more logging to help figure this out
oh one idea. do you have an actual cljs/user.cljs
file on the classpath?
There are clj/user.clj files generated by Luminus template, but certainly nothing like that. All my ns start with orgpad