This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-03-16
Channels
- # babashka (48)
- # beginners (72)
- # calva (65)
- # cider (10)
- # clerk (11)
- # clj-kondo (14)
- # clojure (85)
- # clojure-austin (11)
- # clojure-czech (1)
- # clojure-europe (26)
- # clojure-nl (1)
- # clojure-uk (6)
- # core-matrix (1)
- # cursive (8)
- # datomic (20)
- # docker (38)
- # emacs (2)
- # events (1)
- # fulcro (6)
- # funcool (6)
- # hyperfiddle (79)
- # introduce-yourself (1)
- # lsp (131)
- # malli (32)
- # off-topic (11)
- # pathom (3)
- # re-frame (11)
- # reagent (15)
- # releases (2)
- # shadow-cljs (49)
- # sql (3)
- # tools-deps (36)
Hello! I am struggling to figure out how to split my app in two modules with different lifecycles - a main.js
with most of the code, which changes rarely and thus can be compiled once and reused, and a session.js
which needs to be compiled on-demand for each user, and which depends on stuff from my main ns <> the main module.
I have declared two modules with the correct entrypoints but currently whenever I release
, both are recompiled and I suspect that main
may change between these compilations (f.ex. depending on what api exactly session
uses in the case, as Closure tries to optimize and move functionnality around). I.e. I have 2 problems: 1. (assumption) clients cannot cache main.js b/c it may differ for each client, 2. compilation takes longer b/c main is also recompiled.
Is there any solution? Thank you! 🙏
I was thinking of compiling just main into a library but that does not really help - when we compile session, shadow/closure would likely not understand what is already present in the library and does does not need to be compiled into session.js itself…
(Context: we use the cljc clara-rules, which only supports compiling rules into a “session” in Clojure; but we want to do this not at compile time but at runtime, when users supply dynamically built rules so the idea is to compile most of frontend into a rather static package + compile session.js
with the clara session based on the provided rules on demand, and ship that to the frontend to combine with the main bundle and run rules there.)
I see 😭
Main with advanced is some 400k
Hello! I am loving ClojureScript and Shadow-cljs aswell. Use them everyday. Unfortunately though, using @react-spring/web
doesn't work for me (all the other libraries do, useGesture, useDropzone, anything.)
I get this error:
Closure compilation failed with 2 errors
--- node_modules/@react-spring/shared/dist/index.js:2
Transpilation of 'Computed fields' is not yet implemented.
--- node_modules/@react-spring/shared/dist/index.js:2
Transpilation of 'Member references this or super' is not yet implemented.
Any help is appriciated, thank you :)those are errors from the closure compiler, seems the code is using features it doesn't support. assuming you are on the latest versions there isn't much you can do
using webpack is an option https://code.thheller.com/blog/shadow-cljs/2020/05/08/how-about-webpack-now.html#option-2-js-provider-external
I'll check webpack if I gave up on this. The interesting thing is, that it worked for a month, without turning off the compiler. Now I deleted node_modules
, npm install
again, and here we are. The even funnier thing is, the project already runs on a domain, so I don't really know what did I messed up. I dont want to give up my clojure compiler + shadow-cljs node and javascript
, because it's so beautiful and comfortable. Will check back if I found a solution :)
well if you delete node_modules and npm installed you might have gotten a new react-spring/web version
I tried that, before asking any question I spent 2 hours with it. But I think it'll be your webpack
solution after all, if I succeed.
Any ideas? :/
see the blog post, need to load the webpack output file before the shadow-cljs output
https://github.com/paul931224/closure-compiler-error I made a minimal example, maybe someone figures it out. But version 9.6.1
does work, my mistake was trying to downgrade with ^9.6.1
not understanding what ^
means . Version 9.7.1
does not work for some reason. Thanks for the help, I tried out webpack and to compile with babel, but I don't want to lose the simplicity of shadow-cljs
so downgrading was the solution as thheller mentioned :)
though closure is supposed to have that https://github.com/google/closure-compiler/wiki/Supported-features
its likely that they just also started using some other stuff that is not yet supported
I have a persistent issue that suddenly started occurring recently where my cypress tests (build using :npm-module
) fail to load in the test runner with the following error message
Namespace "goog.debug.Error" already declared.
Doing a release build works, but I cannot use compile
or watch
so looks like cypress might be trying to reload the code when already loaded before?
maybe... it only happens when I try and load all of the files that :npm-module
builds. If I only load one built ns file, it works fine
can't tell you. I don't know anything about cypress and how it is loading stuff. maybe you have some old files sitting arround somewhere that shouldn't be there?
Anyone knows if it's possible to run shadow-cljs in a "content script", in a chrome/firefox extension?
I have something like this in my manifest
"content_scripts": [
{
"matches": ["*://*.],
"js": ["public/assets/shadow/js/main.js"]
}
],
It successfully loads the file, but that main.js
file tries to load some other js files which are blocked by Firefox
no. shadow-cljs is a JVM process. at most the tab could connect to that remotely, but even then the user would need to run it locally?
I know in Chrome, you'd need to have a "web_accessible_resources" declaration in the manifest for anything else you wanted the main.js file to pull in
Thanks! That unstuck me 😄 I had to also allow eval (only with v2 manifests), but after that and some changes in :asset-path
and :devtools-url
in the shadow config, I'm finally getting a "shadow-cljs ready!" message!
Maybe https://babashka.org/scittle/ would be a good choice for a browser extension? Looks like you can https://github.com/babashka/scittle/tree/main/doc/nrepl.