Fork me on GitHub
#shadow-cljs
<
2021-11-11
>
thheller06:11:57

@sritchie09 that is a stacktrace that definitely NOT using the latest shadow-cljs version. remember when using :lein true in your shadow-cljs.edn that your project.clj determines the shadow-cljs version, not the npm package.

Sam Ritchie11:11:03

Doh… okay, thank you. I was assuming in retrospect that the command was modifying the dep, as I sometimes see, but it is clearly not. Thanks for the help!

Nathan K08:11:12

Hi all 🙂 I have a question (perhaps a silly question) 🧵

Nathan K08:11:33

I’m following this tutorial: https://www.youtube.com/watch?v=yVb8PS6a4Mk&amp;t=79s In the video he starts shadow-cljs using calva. The command that gets run is: npx shadow-cljs -d cider/cider-nrepl:0.26.0 watch :app This is the same for me. In the video, JS dependencies are installed. For me, they’re not installed. Did he skip a step? I’m looking through the shadow-cljs docs and I can’t see a command that is meant to install dependencies. I could install them myself but I guess I’m just curious why it didn’t work the same way for me. 🙂

npx shadow-cljs -d cider/cider-nrepl:0.26.0 watch :app
npx: installed 97 in 6.588s
shadow-cljs - config: /Users/nathankramer/Projects/nathanKramer/reframe-example/shadow-cljs.edn
shadow-cljs - HTTP server available at 
shadow-cljs - HTTP server available at 
shadow-cljs - server version: 2.16.2 running at 
shadow-cljs - nREPL server started on port 8777
shadow-cljs - watching build :app
[:app] Configuring build.
[:app] Compiling ...
[:app] Build failure:
The required namespace "react" is not available, it was required by "day8/re_frame_10x/inlined_deps/reagent/v1v0v0/reagent/core.cljs".

Nathan K08:11:14

In the meantime, I manually installed the dependencies, and the boots nicely, so no biggie

thheller08:11:34

npm install will install your JS dependencies assuming you have a package.json

Nathan K08:11:34

Yep, thanks. Do you happen to know if that was supposed to happen automatically? Is it usually managed by shadow-cljs? 🙂

thheller08:11:26

it should install automatically if not already installed

thheller08:11:35

that however still requires a package.json being there

Nathan K08:11:36

Interesting, wonder why it didn’t work for me. I do have a package.json, and it has react etc in it. Curious!

thheller08:11:16

if react is already in package.json then shadow-cljs will not trigger a install again

thheller08:11:30

so in that case you just need npm install to get it

Nathan K08:11:24

ok, I thought maybe since I had never run the app it would fetch them, no worries 🙂

pmooser13:11:45

Are the only valid values of :reader-features the values of :target ?

thheller17:11:10

no, it is not coupled to target at all

currentoor17:11:08

Anyone try using shadow-cljs with nodegui? Seems like a descent more performant alternative to electron. https://react.nodegui.org/

👀 1
West18:11:07

Never tried it. I’ve been playing around with Tauri though. https://github.com/tauri-apps/tauri

dvingo19:11:05

I am using tools.build to create an uberjar for the backend portion of a web app. I would like to use shadow.cljs.devtools.api/release from this build script as well. It does work fine for a browser build, the issue is when compiling the cljs tests (`:node-test` target) - because tools.build places the entire project directory on the classpath the test discovery finds a file in the test directory and then expects the namespace to start with test/ :

:cause "Resource does not have expected namespace",
  :data
  {:tag :shadow.build.resolve/unexpected-ns,
   :resource
   "test/my-app/components/events_test.cljs",
   :expected-ns
   test.my-app.components.events-test,
   :actual-ns my-app.components.events-test}}}
I think the browser build works because the entry namespace is provided and discovered on the classpath in the correct spot. So I'm wondering if there are any creative solutions to this problem. The context is running a build in continuous integration where starting two JVM processes slows things down quite a bit.

thheller20:11:57

hmm good question. I guess you could adjust your :ns-regexp to something like "^my-app\..*-test$", that should filter them out just by name?

thheller20:11:50

or whatever the regexp is for anything not starting with test 😛