shadow-cljs

https://github.com/thheller/shadow-cljs | https://github.com/sponsors/thheller | https://www.patreon.com/thheller
thheller 2021-03-01T14:24:54.169300Z

sometimes you really have to wonder what the closure-compiler is doing to the code when this is the "best" pseudo-name it can come up with for a local variable is

$G__37663_G__37667_G__37671_G__37675_G__37682_G__37686_G__37691_anchor_37656_old_coll_37645_old_items_37652$
$G__37664_G__37668_G__37672_G__37676_G__37683_G__37687_G__37692_idx_37657_new_len_37651$$ 

🎯 1
thheller 2021-03-01T14:26:30.169700Z

I mean I know how it comes up with those but it is still kinda spooky to see sometimes

raspasov 2021-03-01T14:39:57.169800Z

It might be processing it through 7 dimensions 😝 (based on the number of G’s)

Alexis Vincent 2021-03-01T18:50:41.171100Z

@thheller Is there an application level fix I can apply to get around -> https://github.com/thheller/shadow-cljs/issues/846#issuecomment-788183542

thheller 2021-03-01T18:52:52.172700Z

you can put a cljs/closure.clj with just (ns cljs.closure) on your classpath

thheller 2021-03-01T18:53:04.173100Z

then you can update the closure-compiler version which has the fix

thheller 2021-03-01T18:53:12.173300Z

(in theory, haven't tried)

thheller 2021-03-01T18:53:40.173800Z

maybe this branch of CLJS also works https://github.com/clojure/clojurescript/tree/bump-closure

Alexis Vincent 2021-03-01T18:53:47.174200Z

Being thrown when Closure hits @stitches/react , required by https://github.com/pmndrs/leva , I’ve tried setting

{:js-options {:resolve {"@stitches/react" {:target :npm
                                             :require "@stitches/react/dist/stitches.react.esm.mjs"}}}})
but that doesnt seem to actually change the file being resolved as can be seen
#error {
 :cause closure errors
 :data {:tag :shadow.build.closure/errors, :errors [{:resource-name node_modules/@stitches/react/dist/stitches.react.cjs.cjs, :source-name node_modules/@stitches/react/dist/stitches.react.cjs.cjs, :line 2, :column 1218, :msg Class names defined inside a function cannot be reassigned.} {:resource-name node_modules/@stitches/react/dist/stitches.react.cjs.cjs, :source-name node_modules/@stitches/react/dist/stitches.react.cjs.cjs, :line 2, :column 1229, :msg Class names defined inside a function cannot be reassigned.} {:resource-name node_modules/@stitches/react/dist/stitches.react.cjs.cjs, :source-name node_modules/@stitches/react/dist/stitches.react.cjs.cjs, :line 2, :column 4095, :msg Class names defined inside a function cannot be reassigned.}]}

thheller 2021-03-01T18:53:49.174500Z

David is working on this currently

Alexis Vincent 2021-03-01T18:54:14.174800Z

Thanks. Will see what I can get right

fsd 2021-03-01T19:00:51.176500Z

Is it possible to view shadow cljs React App on a Mobile Device that is connected to same network?

thheller 2021-03-01T19:01:36.176800Z

sure. just open it in the browser. just need to know the IP of your machine.

fsd 2021-03-01T19:05:14.177400Z

Perfect thanks man :)

Alexis Vincent 2021-03-01T19:06:10.178300Z

Using bump-closure I hit

Syntax error (ClassNotFoundException) compiling at (shadow/build/closure.clj:1:1).
com.google.javascript.jscomp.AnonymousFunctionNamingPolicy
Do you see a quick fix? Or should I wait. Seems like David is pretty active on the branch

thheller 2021-03-01T19:06:22.178600Z

need to update shadow-cljs too 🙂

thheller 2021-03-01T19:07:03.179Z

oh nevermind. I haven't released the version with the fix yet.

thheller 2021-03-01T19:07:06.179200Z

hang on I can do that now

Alexis Vincent 2021-03-01T19:09:19.179400Z

🎉 🙏

thheller 2021-03-01T19:14:33.179700Z

@mail024 2.11.19 should fix that

Alexis Vincent 2021-03-01T19:14:48.180Z

Shweeeet. Will give it a go

Alexis Vincent 2021-03-01T19:20:00.180700Z

The required namespace "goog.result" is not available, it was required by "shadow/xhr.cljs".
might be another removal

Alexis Vincent 2021-03-01T19:20:36.181Z

Against bump-closure

thheller 2021-03-01T19:22:29.181200Z

don't bump the closure library for now

thheller 2021-03-01T19:22:32.181500Z

closure-compiler is enough

Alexis Vincent 2021-03-01T19:23:41.182200Z

Ah, I’m just using David’s branch. Dont really know what you mean by the cljs/closure.clj thing.

Alexis Vincent 2021-03-01T19:24:35.182700Z

Do i just add an exclude and drop the dep down

Alexis Vincent 2021-03-01T19:24:39.183Z

org.clojure/google-closure-library {:mvn/version "0.0-20201211-3e6c510d"}

thheller 2021-03-01T19:25:00.183400Z

you put the file on the classpath. meaning you take one of your source-paths and put the file there

thheller 2021-03-01T19:25:08.183800Z

src/main/cljs/closure.clj or so

thheller 2021-03-01T19:25:23.184200Z

then you can stick with older CLJS version or rather the current 1.10.773

Alexis Vincent 2021-03-01T19:25:31.184500Z

No i get that. But im not sure what to put inside. When i found the file in the clojurescript repo it looked very long

Alexis Vincent 2021-03-01T19:25:42.185Z

maybe i found the wrong one

thheller 2021-03-01T19:25:49.185200Z

as I said ... just (ns cljs.closure) nothing else

thheller 2021-03-01T19:25:59.185500Z

shadow-cljs does not use that file at all, so it can be empty

Alexis Vincent 2021-03-01T19:26:13.186Z

Oh right.

Alexis Vincent 2021-03-01T19:26:17.186300Z

cool

thheller 2021-03-01T19:26:18.186400Z

it is nrepl piggieback loading that file so if you don't need that then you don't need to worry about that at all either

Alexis Vincent 2021-03-01T19:26:40.186800Z

thanks. Will give that a go

thheller 2021-03-01T19:26:53.187200Z

but since nrepl is started by default its best to just replace the file temporarily

thheller 2021-03-01T19:28:17.188Z

oh and it might matter which tools.deps version you use too. since older versions didn't put source-paths first this trick might not work there

thheller 2021-03-01T19:28:21.188200Z

current version should though

thheller 2021-03-01T19:28:40.188700Z

basically by putting it one the :paths (or :source-paths if just shadow-cljs.edn) you are "overwriting" the file in the clojurescript released jar

Alexis Vincent 2021-03-01T19:29:21.189300Z

Yeah. With you on that! Just thought i needed to overwrite the file with something useful.

Alexis Vincent 2021-03-01T19:29:30.189500Z

Thanks!

Alexis Vincent 2021-03-01T19:30:56.190Z

Whoop whoop!!! It compiled without errors on the new closure compiler!

Alexis Vincent 2021-03-01T19:31:10.190300Z

Thanks @thheller. Appreciate it!