This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-17
Channels
- # announcements (2)
- # asami (3)
- # babashka (30)
- # beginners (23)
- # calva (28)
- # cider (3)
- # clj-kondo (16)
- # clj-on-windows (7)
- # cljs-dev (7)
- # clojure (47)
- # clojure-austin (3)
- # clojure-europe (25)
- # clojure-gamedev (3)
- # clojure-greece (1)
- # clojure-nl (1)
- # clojure-uk (3)
- # clojurescript (54)
- # community-development (24)
- # conjure (16)
- # duct (1)
- # emacs (8)
- # events (1)
- # figwheel-main (4)
- # fulcro (13)
- # gratitude (20)
- # helix (3)
- # honeysql (8)
- # hyperfiddle (12)
- # introduce-yourself (1)
- # jobs (6)
- # lambdaisland (1)
- # lsp (23)
- # malli (1)
- # meander (27)
- # minecraft (11)
- # off-topic (12)
- # pathom (1)
- # portal (11)
- # releases (1)
- # remote-jobs (1)
- # ring (11)
- # sci (1)
- # shadow-cljs (53)
- # specter (5)
- # xtdb (20)
At my day job we have mostly ClojureScript projects, but one project is being ported to NextJS. This is a browser project. We have some libraries written in ClojureScript that we want to consume from the NextJS project. What are our options if we do not want to load several instances of the ClojureScript runtime? Since it is only one JS project maybe it would work to build one browser module with one endpoint per CLJS library? Any new JS projects would do something similar.
@pez https://clojureverse.org/t/generating-es-modules-browser-deno/6116 or the older :target :npm-module
hi @thheller. since the last cljs release, data_readers.cljc containing reader conditionals works. for example:
#?(:clj {}
:cljs {foo/bar my.project.foo/bar})
but this does not work in shadow. It looks like `
(cljs.analyzer/load-data-readers)
is not getting called as it does when invoking cljs.build.api/build
they are opt-in in shadow-cljs. you need to set :compiler-options {:data-readers true}
in the build config
no clue if it works then though. I don't think data readers should ever be used for anything directly in source code
also, tags from data_readers.cljc files are used when reading data with cljs.reader fns
yeah, and I don't ever want those to leak into my build just because they are on the classpath
it also creates certain "undefined load order" issues since things break if you don't actually ever require the namespaces uses in those directly
if you do all bets are off regarding caching and build reliability. so use with care.
it's not working. in shadow I see
;; taken from cljs.closure since its private there ...
(defn load-data-reader-file [mappings ^java.net.URL url]
in shadow.build.classpath . the load-.. fn has moved to cljs.analyzer and is still private. although e.g.
(cljs.analyzer/load-data-readers)
is public, with memoized and unmemoized versionsHi, I am getting
Execution error (AWTError) at sun.awt.X11GraphicsEnvironment/initDisplay (X11GraphicsEnvironment.java:-2).
Can't connect to X11 window server using '172.18.32.204
when running npx shadow-cljs browser-repl
. I am inside a VM without X-server. Anyone has an idea?Seeing
Execution error (ClassNotFoundException) at java.net.URLClassLoader/findClass (URLClassLoader.java:476).
com.google.javascript.jscomp.JSModule
Unfortunately haven't been able to reproduce this issue in a simple project.
Using
org.clojure/clojure {:mvn/version "1.11.1"}
org.clojure/clojurescript {:mvn/version "1.11.51"}
thheller/shadow-cljs {:mvn/version "2.19.0"}
I'll include the full stacktrace in this thread.very likely to be a dependency conflict. make sure you have the appropriate closure-compiler and cljs versions (guessing you are using project.clj or deps.edn to manage dependencies)
check which closure-compiler version oyu are getting via clj -A:your-aliases -Stree
or so
org.clojure/clojurescript 1.11.51
. com.google.javascript/closure-compiler-unshaded v20220502 :newer-version
This?returns nil
you do actually use deps.edn to manage dependencies correct? there is a :deps true
or :deps {:aliases ...}
in your shadow-cljs.edn
?
#object[java.net.URL 0x7af707e0 "jar:file:/home/foobar/.m2/repository/thheller/shadow-cljs/2.19.0/shadow-cljs-2.19.0.jar!/shadow/build/closure.clj"
But fair enough. I'm working in a mono repo with lots of projects, most of which are on old versions of shadow. I'd expect -Stree
to have revealed that the old shadow is being used but maybe there is something else funky going on.
closure compiler version you can check via (
#object[java.net.URL 0x7da10b5b "jar:file:/home/foobar/.m2/repository/com/google/javascript/closure-compiler-unshaded/v20220502/closure-compiler-unshaded-v20220502.jar!/com/google/javascript/jscomp/JSChunk.class"]
and
nil
respectivelythat all looks fine. assuming that is what the classpath actually is when shadow-cljs runs
Found the issue... π€― There are actually 2 shadow builds that run in parallel when I call a script and so the error messaging was coming from that second build which I never pay attention to. Oops. And ofcourse it has its own deps.edn and so I was checking in the repl sourcing the wrong deps.edn. TLDR: running stuff in parallel makes logs confusing π
Thanks for your help. Much appreciated
Hello everyone! I am in need of help with installation of shadow-cljs. I'm trying to add syncfusion dependency, but it's giving error: The required JS dependency "@syncfusion/ej2-react-layout" is not available, it was required by "poc/core.cljs".
It's in package.json, and I have it installed too.
quick google suggest the package name is actually @syncfusion/ej2-react-layouts
. so you are missing an s
?
Oh... my ... :man-facepalming:
Hi @thheller, I have coded the the components, it's compiling successfully, but output is not showing.
It means I've coded the components, but there's something wrong with Interop. Right?
don't have a clue. I know neither the library you are using nor the interop lib. I also haven't used react in many years. ask in the appropriate channel.
Thanks