shadow-cljs

https://github.com/thheller/shadow-cljs | https://github.com/sponsors/thheller | https://www.patreon.com/thheller
happyb3at 2021-04-16T10:19:35.251800Z

How to debug this error? I create a brand new project but get IllegalArgumentException: no conversion to symbol Clojure lein new re-frame duck Retrieving re-frame/lein-template/2.1.2/lein-template-2.1.2.pom from clojars Retrieving re-frame/lein-template/2.1.2/lein-template-2.1.2.jar from clojars Generating re-frame project. ➜ Clojure cd duck  ➜ duck shadow-cljs run shadow-cljs - config: /home/hovgaard/Clojure/duck/shadow-cljs.edn shadow-cljs - updating dependencies Retrieving thheller/shadow-cljs/2.12.5/shadow-cljs-2.12.5-aot.jar from https://repo.clojars.org/ shadow-cljs - dependencies updated running: npm install --save --save-exact react@17.0.1 react-dom@17.0.1 added 101 packages, and audited 102 packages in 2s 3 packages are looking for funding  run npm fund for details found 0 vulnerabilities IllegalArgumentException: no conversion to symbol        clojure.core/symbol (core.clj:596)        clojure.core/symbol (core.clj:589)        shadow.cljs.devtools.cli-actual/do-clj-run (cli_actual.clj:70)        shadow.cljs.devtools.cli-actual/do-clj-run (cli_actual.clj:65)        shadow.cljs.devtools.cli-actual/blocking-action (cli_actual.clj:126)        shadow.cljs.devtools.cli-actual/blocking-action (cli_actual.clj:116)        shadow.cljs.devtools.cli-actual/main (cli_actual.clj:177)        shadow.cljs.devtools.cli-actual/main (cli_actual.clj:132)        clojure.core/apply (core.clj:669)        clojure.core/apply (core.clj:660)        shadow.cljs.devtools.cli-actual/-main (cli_actual.clj:219)        shadow.cljs.devtools.cli-actual/-main (cli_actual.clj:217)        clojure.lang.Var.applyTo (Var.java:705)        clojure.core/apply (core.clj:665)        clojure.core/apply (core.clj:660)        shadow.cljs.devtools.cli/-main (cli.clj:75)        shadow.cljs.devtools.cli/-main (cli.clj:67)        clojure.lang.Var.applyTo (Var.java:705)        clojure.core/apply (core.clj:665)        clojure.main/main-opt (main.clj:514)        clojure.main/main-opt (main.clj:510)        clojure.main/main (main.clj:664)        clojure.main/main (main.clj:616)        clojure.lang.Var.applyTo (Var.java:705)        clojure.main.main (main.java:40) duck clojure --version Clojure CLI version 1.10.3.822 duck java --version openjdk 11.0.10 2021-01-19 OpenJDK Runtime Environment 18.9 (build 11.0.10+9) OpenJDK 64-Bit Server VM 18.9 (build 11.0.10+9, mixed mode, sharing)

thheller 2021-04-16T11:14:57.252900Z

@alan.hovgaard why do you call shadow-cljs run? that expects more arguments? did you mean shadow-cljs server, shadow-cljs watch app or so?

Schpaa 2021-04-16T15:21:33.263900Z

Getting this when trying to include some modules of codemirror

Closure compilation failed with 1 errors
--- node_modules/lezer-tree/dist/tree.cjs:385
ES6 transpilation of 'declaration with multiple destructuring children not in statement block' is not yet implemented.

Schpaa 2021-04-16T15:21:48.264100Z

is there a trick I could do to avoid this?

thheller 2021-04-16T15:29:02.264700Z

set :compiler-options {:output-feature-set :es6}

Schpaa 2021-04-16T15:29:08.264900Z

nice, that works, and thanks!

mkvlr 2021-04-16T16:09:17.265100Z

go lezer!

happyb3at 2021-04-16T18:07:06.265300Z

Wow yeah.. shadow-cljs watch app ...all works fine... RTFM... thx thheller 🙂

2021-04-16T18:18:34.269300Z

hey folks, i'm using shadow-cljs to create a Github Action that uses cljs (targeting nodejs). I'm getting what looks like extern related errors when the built JS is run by Github. I do see some inference warnings in the shadow-cljs build output here's the error I see when the github action is run: "f.git.zc is not a function" here's the code that's failing (println (<p! (.. octokit -git (updateRef update-args)))) - octokit is pulled from a github npm library. so this def seems externs related but I'm wondering how i'd resolve this in a nodejs context? do I really need to add externs for each function i want to use from github's library? interestingly, i have another line prior to the above which seems to run successfully without any extern issues: ref-resp (js->clj (<p! (.. octokit -git (getRef ref-args)))) any idea what might be happening here?

thheller 2021-04-16T18:20:36.270Z

the problem is that core.async loses typehints so even if you type hint the externs inference doesn't work correctly

thheller 2021-04-16T18:20:44.270200Z

but yeah this is an externs issue

thheller 2021-04-16T18:22:13.270600Z

you can fix it by moving as much interop code out of the go block as possible

2021-04-16T18:22:56.271200Z

so if i wrap those lines in a function defined outside of the go block, i should be good?

thheller 2021-04-16T18:23:15.271500Z

depends on what octokit is but in theory yes

2021-04-16T18:25:21.271700Z

i'll try it and see what happens

2021-04-16T18:37:49.272Z

so that looks like it's workign thanks @thheller

2021-04-16T18:38:15.272600Z

just out of curiosity do you recommend folks use a lib like cljs-oops in order to not worry about externs?

thheller 2021-04-16T18:38:47.273100Z

I wouldn't recommend using it

thheller 2021-04-16T18:39:07.273500Z

normally externs inference is a much better way to go, it just suffers a little in core.async

👍 1
2021-04-16T18:47:39.277Z

ok i actually had one last question (though this might be more on the github actions end) - if i don't commit the node_modules/ directory along with the JS script that shadow-cljs outputs, then I get this error when the script is run on github: Error: Cannot find module '@actions/core' while committing node_modules/ alongside the script seems to work, i always thought doing a release with shadow-cljs would automatically use the closure compiler to inject the relevant JS from those node modules into the outputted script. i feel like there might be a piece of this i'm not following

thheller 2021-04-16T18:48:50.277500Z

by default :node-script (which I assume you are using?) does not bundle the dependencies since node will provide them via node_modules

thheller 2021-04-16T18:49:13.277800Z

you can post-process the file with https://github.com/vercel/ncc which would make it standalone

2021-04-16T18:50:12.278500Z

ah k, i saw that recommended elsewhere, was wondering if its still the same with shadow. cool ty