shadow-cljs

https://github.com/thheller/shadow-cljs | https://github.com/sponsors/thheller | https://www.patreon.com/thheller
hadils 2021-02-04T15:28:09.375500Z

Ok. I am using React Native and Expo with an iOS simulator. I got the IP addresses to line up and disabled fast refresh on the simulator. When I refresh my code the simulator displays the new set up immediately, then reloads the previous state. What am I doing wrong?

thheller 2021-02-04T15:29:28.375800Z

probably still have the expo reload active

hadils 2021-02-04T15:29:54.376300Z

It says disabled on the simulator pop-up...

thheller 2021-02-04T15:30:50.377300Z

sorry I don't use react-native or expo and it has been a couple years since I tested this. there used to be a separate expo reload. no clue if that still exists. I cannot help you track this down but if you see two reloads then this is the most likely cause.

hadils 2021-02-04T15:31:14.377500Z

Ok, thanks for the lead!

rschmukler 2021-02-04T16:44:25.379200Z

Hey all! I recently just updated my shadow version on a project (from 2.8 to 2.11) and am now seeing a "Failed to inspect file <path>.css" - it's coming from a JS file that is built and imports a CSS file via require. I would expect this issue https://github.com/thheller/shadow-cljs/issues/598 to have solved this, but maybe I'm missing something. I also kinda remember an ignore-resources option existing once, but I'm not sure if I'm misremembering

rschmukler 2021-02-04T16:44:45.379800Z

Any tips on how to best resolve this?

rschmukler 2021-02-04T16:45:11.380100Z

(Also, interestingly, the same application compiles fine under 2.8)

thheller 2021-02-04T16:46:26.380900Z

@rschmukler the default changed from ignoring asset css requires to failing them so they don't go unnoticed. you can set :js-options {:ignore-asset-requires true} to get the old behaviour

rschmukler 2021-02-04T16:46:51.381400Z

Wonderful, thank you for the help! Is this potentially worth documenting in the user-guide? I will add a comment to that issue as well

isak 2021-02-04T17:24:27.382800Z

Having a problem with inspect - my taps are not showing up in the Inspect stream. I have devtools.preload in the :preloads. Has something changed?

thheller 2021-02-04T17:52:56.383400Z

devtools.preload? that is not from shadow-cljs or related to inspect

isak 2021-02-05T15:35:13.419300Z

I'm sure the tap&gt;s are getting executed because I have console logging on the same code path

isak 2021-02-05T15:36:06.419500Z

And yea, it does say stuff like shadow-cljs: #21 ready! in the console also.

isak 2021-02-05T15:37:57.420600Z

I just tried executing tap via browser-repl, and those values do show up

thheller 2021-02-05T15:39:09.421300Z

do you maybe tap&gt; too early? like on page load?

isak 2021-02-05T16:09:04.433300Z

hmm yea it is pretty quick, I'll try delaying it

thheller 2021-02-05T16:09:49.433500Z

the tap> is only setup after the ready message so if you log before that it won't make it to the UI

isak 2021-02-05T16:10:51.433700Z

yea, that was it

isak 2021-02-05T16:11:03.433900Z

Can my program listen for the ready message?

thheller 2021-02-05T16:14:49.434100Z

no, not currently

isak 2021-02-05T16:17:35.434400Z

Would you accept a PR to have the shadow tap listener queue messages until the page is ready, then flush?

thheller 2021-02-05T16:19:26.434600Z

if you do it in a clean way. the way this is currently set up this isn't easily possible.

isak 2021-02-05T16:19:48.434800Z

Ok, I may give this a shot. Thanks for the help!

thheller 2021-02-04T17:53:20.383900Z

doesn't require any config actually, it is on by default with watch builds

Helins 2021-02-04T18:17:45.386900Z

I am watching my source files using Hawk. Ordinarily, when I hit save, I get 1 :modify event as expected. However, when running Shadow in watch mode, saving a single file results suddenly in all that io:

:hawk :create #object[java.io.File 0x18f77246 /home/adam/projects/clj/helins/medium/src/dev/helins/medium/4913]
:hawk :modify #object[java.io.File 0x52954b80 /home/adam/projects/clj/helins/medium/src/dev/helins/medium/4913]
:hawk :delete #object[java.io.File 0x58038f69 /home/adam/projects/clj/helins/medium/src/dev/helins/medium/4913]
:hawk :delete #object[java.io.File 0x7f50d4a /home/adam/projects/clj/helins/medium/src/dev/helins/medium/dev.cljc]
:hawk :create #object[java.io.File 0x43e0fe21 /home/adam/projects/clj/helins/medium/src/dev/helins/medium/dev.cljc~]
:hawk :create #object[java.io.File 0x393148d /home/adam/projects/clj/helins/medium/src/dev/helins/medium/dev.cljc]
:hawk :modify #object[java.io.File 0x3fffaee3 /home/adam/projects/clj/helins/medium/src/dev/helins/medium/dev.cljc]
:hawk :delete #object[java.io.File 0x4b70ec0a /home/adam/projects/clj/helins/medium/src/dev/helins/medium/dev.cljc~]
Is that normal?

thheller 2021-02-04T18:21:55.387300Z

shadow is just watching. it never modifies your source files ever, it only reads. the events happening are done by you

thheller 2021-02-04T18:22:01.387500Z

likely your editor

Helins 2021-02-04T18:24:33.388100Z

Hmmm, weird, I get that behavior only when Shadow is running (same editor and all...)

Helins 2021-02-04T18:24:54.388500Z

But yeah, I was surprised at the idea it might modify anything in the source

isak 2021-02-04T18:42:46.389300Z

Ah, that is the console.log formatter, never mind. But yea sounds like I should be seeing taps, but I'm not seeing any.

thheller 2021-02-04T18:46:28.389500Z

check the browser console if its connected properly

thheller 2021-02-04T18:52:10.389700Z

don't know what you are doing so really can't help much. try shadow-cljs browser-repl or shadow-cljs node-repl and see if those show up

dpsutton 2021-02-04T19:22:12.391500Z

i'm attempting to startup up a :deps true style project with CIDER. I'm getting the dreaded "missing instance". I remember reading in the users guide (although i can no longer find it) that if i made sure ensure that shadow's middleware was included all would be good. I'm attempting:

/usr/local/bin/clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version "0.8.3"} cider/piggieback {:mvn/version "0.5.2"} cider/cider-nrepl {:mvn/version "0.25.8"}} :aliases {:cider/nrepl {:main-opts ["-m" "nrepl.cmdline" "--middleware" "[\"cider.nrepl/cider-middleware\",\"shadow.cljs.devtools.server.nrepl/middleware\",\"cider.piggieback/wrap-cljs-repl\"]"]}}}' -M:test:cider/nrepl
and then
(do (require '[shadow.cljs.devtools.api :as shadow]) (shadow/watch :app) (shadow/nrepl-select :app))
after startup and i'm still getting the missing intance message. Is there something i'm skipping over?

dpsutton 2021-02-04T19:23:50.392100Z

piggieback is not necessary but cider still sticks it in when doing clojurescript

dpsutton 2021-02-04T19:28:38.392700Z

ah i'm sorry. I've found (and documented before) that i need to call (shadow.cljs.devtools.server/start!)

thheller 2021-02-04T20:29:00.394Z

@dpsutton yeah missing instance always means that shadow-cljs has not been started in the JVM you are connected to. which won't happen if you just start an nrepl server like the command above.

👍 1
dpsutton 2021-02-04T20:34:56.395300Z

the strange thing is i had npx shadow-cljs server which includes :nrepl {:port 8701}. My understanding is that it would have been the server

thheller 2021-02-04T20:42:16.396Z

yes, that is the server but you don't seem to be connected to it

thheller 2021-02-04T20:42:47.396500Z

the above commands starts its own nrepl server in a new JVM which cider then probably connects to

thheller 2021-02-04T20:43:26.397200Z

if you want to do it absolutely correctly and the way it is intended then DO NOT configure a fixed :nrepl port and instead look up the port in .shadow-cljs/nrepl.port

thheller 2021-02-04T20:43:33.397400Z

or rather teach cider how to do that 😛

thheller 2021-02-04T20:44:00.397700Z

still no clue how cider works or does

dpsutton 2021-02-04T20:51:05.398300Z

haha. i know more about it than only 2 or 3 people and i'm still working it out 🙂 Trying to figure out how to setup <https://logseq.com/> for local dev

Lukas 2021-02-04T20:56:39.399Z

Hello, I use emacs/cider and have a clojurescript project build with shadow cljs. I connected to the nrepl server, but I'm not able to send s-expressions to the repl with C-c C-e like I normally do. Can someone here me with this?

dpsutton 2021-02-04T20:57:26.399300Z

wanna chat in #cider for the time being? Most likely an issue with setup and not actually shadow

thheller 2021-02-04T20:58:03.399500Z

hopefully that makes it clearer in the future https://github.com/thheller/shadow-cljs/commit/c7c831e19851ff4ef1fa4967abb60b469fc76b98

Lukas 2021-02-04T20:58:41.399700Z

Okay, I already raised the question in #cider 🙂

Lukas 2021-02-04T20:58:58.399900Z

should I delete this thread?

dpsutton 2021-02-04T20:59:17.400100Z

nah. its a single comment and if anyone has a similar issue maybe they'll be directed to #cider

dpsutton 2021-02-04T20:59:41.400300Z

lovely

Nolan 2021-02-04T23:08:48.403200Z

hi there—think im running into a user error here when trying to override config from the repl. ive been trying to walk this path:

(shadow/compile
 :build1
 {:config-merge
  {:closure-defines '{<http://my.app/SOMETHING|my.app/SOMETHING> true}}})
and i must be getting something slightly off because it gives the error that the structures can't be merged. the exception makes it look like the structure is a seq of map entries rather than a map potentially? sincere apologies if ive missed something in the manual that addresses this use-case

Nolan 2021-02-04T23:10:11.403300Z

i actually think the solution im aiming for will eliminate the need to do this, but in general this seemed like something someone might want to do