Fork me on GitHub
#shadow-cljs
<
2022-01-10
>
thheller06:01:44

can you explain the troubleshooting section? why does commenting out :js-options fix it or what error did it reveal? where is the rest of the stacktrace?

AssertionError Assert failed: (map? rc)
...

thheller06:01:50

this error obviously shouldn't occur

rberger23:01:47

I’ll generate a full stack trace as soon as I get a chance. I don’t know why it was doing this. But it was a blocker to me until I figured out that was masking the real error.

martinklepsch09:01:46

(defn node-repl
  []
  (shadow/node-repl {:config-merge [{:js-options {:js-package-dirs ["functions/node_modules"]}
                                     ,,,}]}))
Is this a valid thing to specify with node-repl? We’ve split our package.json between frontend/backend recently and it looks like the node REPL isn’t able to find packages that only exist in the backend node_modules.

martinklepsch10:01:52

Actually it looks like other parts of the build are also broken with a similar error 😅

thheller16:01:58

(shadow/node-repl {:pwd "functions"}) so it runs the node repl process in the functions dir

thheller16:01:31

otherwise it runs in the project dir and since no node builds bundle any dependencies directly node won't find them at runtime

martinklepsch16:01:08

ohh, that sounds like exactly what’s needed!

thheller16:01:50

I'm not sure anyone has ever used that option so I don't even know if it works 😛

martinklepsch16:01:16

Should I keep the js-options one around too? just with :pwd I’m getting the same “cannot find module” errors as before

martinklepsch16:01:43

Maybe :pwd isn’t working 😄

thheller16:01:24

please be more precise with the error report 😛

thheller16:01:43

shadow-cljs can't find it or node cannot find it? two very different things with very different solutions

thheller16:01:49

also note that if you had already startet a node-repl that may still be running and running node-repl again may just have reused that process?

thheller16:01:26

(js/process.cwd) should tell you if :pwd worked

thheller16:01:04

:js-options you need to keep if you have any (:require [a-symbol-pointing-to-npm-package ...])

thheller16:01:13

eg. (:require [react])

thheller16:01:35

to know that react is actually meant to be a npm require if needs to check the package dirs

thheller16:01:56

(:require ["react"]) does not need that check since it knows that string requires are not valid for CLJS namespaces

thheller16:01:30

also check js/process.env.PWD

martinklepsch18:01:52

actually it is working! I accidentally passed it inside the config-merge option instead of to shadow/node-repl directly

ingesol14:01:17

I’m trying to control the logging of shadow-cljs by doing

--config-merge '{:closure-defines {shadow.cljs.devtools.client.env/log false}}'
I was expecting shadow-cljs: load JS something/something.cljs logging to go away after looking at what seems to be relevant source code, but it’s still there. Am I supposed to be able to control this?

ingesol14:01:31

Context: It’s a big app where many of the changes I make trigger very many such lines, and I’m mostly not interested in that info.

ingesol14:01:23

I suppose a nice alternative would be an option for compacting that info to something like “15 JS files loaded”.

thheller16:01:55

:devtools {:log false} in your build config (or merged)

ingesol08:01:06

awesome, thanks!