Fork me on GitHub
#shadow-cljs
<
2023-02-10
>
Ben Lieberman13:02:15

hi, I'm working with shadow-css and re-frame. I started adding some clj files to my project so I added a deps.edn and I am now using that to connect to a REPL. When I was still using shadow-cljs.edn I followed the recommended steps for developing with shadow-css at the REPL. Now that I'm using deps.edn, though, I'm having issues. When I connect with npx shadow-cljs clj repl and try to load the repl ns, it either cannot find shadow.css.build or the symbol update-vals from build.cljc is unresolved.

thheller19:02:45

the shadow-css dependency needs to be available and it requires clojure 1.11.1, you maybe have 1.10?

Ben Lieberman19:02:01

ah, yeah it is the version... :face_palm::skin-tone-2: thanks @U05224H0W!

borkdude14:02:08

Does :target :node-library support code-splitting / modules?

borkdude14:02:45

Currently #C03DPCLCV9N uses this setting and we want to make some libraries available lazily using modules. cc @U0ETXRFEW

borkdude14:02:25

I suspect that this is not supported, glancing over the UsersGuide

pez14:02:14

I don't quite understand these things. I know there is also :npm-module, but I think that might be a rather unsupported target, and I have no clue if it supports code splitting anyway.

pez14:02:35

Can we get away with using multiple :node-library targets?

pez14:02:03

Or does that pack the whole cljs runtime in each, maybe...

borkdude14:02:12

I think it does yes. Also we can't use es6: https://github.com/electron/electron/issues/21457

borkdude14:02:14

@U0ETXRFEW Well, maybe we should add rewrite-clj and just hope for the best then

pez14:02:53

Non-lazily?

borkdude14:02:47

I see no other option

pez14:02:35

I don't think it will add much startup time. We can measure it.

borkdude14:02:15

I am working on a PR, let's continue the conversation elsewhere to not bug the people here

thheller18:02:10

:node-library does not support splitting, :npm-module is an option

borkdude19:02:12

ok, I'll try that

borkdude19:02:35

it's not clear to me how to declare the modules in npm-module. I tried :modules but that seems to be ignored

borkdude19:02:08

I wish I could just use target esm everywhere, but alas, electron won't let you

thheller19:02:13

quite sad they still don't support esm

fabrao15:02:55

Hello all, is that possible to do in Clojurescript something like plug-in that it can be load after, as a selectable module into frontend?

thheller18:02:22

a generic plugin system is not possible with :advanced builds no

fabrao19:02:38

Hello @U05224H0W, thank you for your time. Plugin system I mean if I want to provide some new feature as dynamic module, like new option in system.

thheller19:02:03

if these features are known at compile time then code splitting

thheller19:02:18

if they are completely independent then no, there is no good way to do that

fabrao19:02:05

but can I provide another .js from other project to be load after and be included ?

thheller19:02:04

if that other js is not cljs output then yes

fabrao19:02:36

it should be other re-frame project too

thheller19:02:07

then it will have its own re-frame/reagent/react/etc version that will likely conflict and not be compatible with your own

fabrao19:02:31

hummm, understood

thheller19:02:03

if you don't care for :advanced optimization and :simple is good enough then this is doable, but still tricky and not supported out of the box

Braden Shepherdson16:02:56

I'm getting

[:app] Compiling ...
Closure compilation failed with 1 errors
--- metabase/domain_entities/queries/util.cljc:13
and it's not clear from that line what the issue is. is there a flag to set or a hidden folder where I see the intermediate JS? (or the macroexpanded CLJS code?) there's a new, complex macro in play here, but it seems to be correct from playing around with macroexpand.

thheller18:02:36

hmm doesn't it tell you the actual error?

Braden Shepherdson18:02:17

not the way I was running it. running npx shadow-cljs release app directly showed me the error. but it was just "missing semicolon" which didn't help much.

Braden Shepherdson18:02:29

I fixed the issue eventually by binary-searching the contents of my macro.

thheller18:02:42

that is often an indicator of invalid generated JS

Braden Shepherdson18:02:10

the trouble seems to have been generating (let [defn# (defn ...)] (other things) defn#)

thheller18:02:17

you can find the generated JS in the .shadow-cljs/builds/release/<the-build-id> folders

borkdude16:02:38

I'm trying to run the build report hook in joyride but it fails with:

NoSuchFileException: out/js/main.js
When I change :output-to to "out/js/main.js" it does work. Perhaps it's hardcoded?

thheller18:02:27

build reports are only currently support for :browser builds

borkdude19:02:21

@U05224H0W I did manage to get it work though with very useful output:

borkdude19:02:06

I'm also using the build report with target esm in nbb btw

Greg Jeanmart21:02:33

What would be the best way to use a web library that performs https://github.com/WalletConnect/web3modal/blob/V2/packages/html/src/client.ts#L25? Right now, when instantiating this lib, I'm getting Uncaught (in promise) Module not provided: @web3modal/ui Thanks for your help 🙏

thheller09:02:16

or vite also is capable of this I think

Greg Jeanmart12:02:56

Thanks a lot @U05224H0W. I'll give it a try 😉