This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-03-01
Channels
- # announcements (7)
- # babashka (10)
- # beginners (60)
- # clerk (4)
- # clojure (19)
- # clojure-conj (5)
- # clojure-europe (48)
- # clojure-nl (1)
- # clojure-norway (6)
- # clojure-uk (2)
- # clojurescript (12)
- # conjure (2)
- # core-async (24)
- # cursive (3)
- # datalevin (18)
- # events (1)
- # figwheel-main (5)
- # fulcro (22)
- # honeysql (29)
- # hyperfiddle (60)
- # jobs (3)
- # leiningen (18)
- # lsp (47)
- # meander (21)
- # missionary (6)
- # off-topic (35)
- # reagent (14)
- # remote-jobs (1)
- # ring (1)
- # shadow-cljs (32)
- # sql (10)
- # transit (12)
Sentry recently added @sentry/replay
to their packages and then added https://github.com/getsentry/sentry-javascript/pull/6508to save people an extra require / streamline the API. Unfortunately this assumes tree shaking of npm code which shadow isn’t doing(?), which caused our build to grow by 130kb.
Is there any way to manually exclude a package? Could this be imrpoved in shadow?
what a stupid reason. removing an import and putting all the burden on tooling to figure out what you actually wanted.
yeah I also found that logic a bit rage-inducing… saved one line — bravo
you can set :js-options {:resolve {"@sentry/replay" false}}
in the build config, assuming its never actually used that should work
Has anyone integrated koacha for running tests in a shadow-cljs project? Any tips to share if I give it a try?
https://github.com/lambdaisland/kaocha-cljs2 has examples IIRC
Ooh! Hadn't noticed the shadow-cljs.edn in the project root. Thanks for the pointer! And further down is a nice example..
@martinklepsch for reference: npm packages are always passed through google closure's simple optimizations since the vast majority of code on npm breaks under advanced optimizations
there is a setting in shadow cljs to pass npm dependencies through advanced optimizations anyway, but you'll see basically all of your npm dependencies break when you set it
❯ netcat localhost 51345
shadow-cljs - REPL - see (help)
To quit, type: :repl/quit
shadow.user=> (shadow/node-repl)
cljs.user=> shadow-cljs - #5 ready!
(require 'metabase.util.log-test :reload)
nil
cljs.user=> (require 'metabase.util.log-test :reload) ;; run twice no error
nil
cljs.user=> (in-ns 'metabase.util.log-test)
nil
metabase.util.log-test=> (logf-formatting-test)
[metabase.util.log-test] "input: 8, 3; output: ignored"
nil
metabase.util.log-test=> (require 'metabase.util.log-test :reload)
------ REPL Error while processing ---------------------------------------------
(require 'metabase.util.log-test :reload)
no source by provide: metabase.util.log-test
{:provide metabase.util.log-test}
ExceptionInfo: no source by provide: metabase.util.log-test
shadow.build.data/get-source-id-by-provide (data.clj:192)
shadow.build.data/get-source-id-by-provide (data.clj:187)
shadow.build.data/get-source-by-provide (data.clj:195)
shadow.build.data/get-source-by-provide (data.clj:194)
shadow.build.resolve/resolve-repl (resolve.clj:725)
shadow.build.resolve/resolve-repl (resolve.clj:719)
shadow.cljs.repl/repl-require (repl.clj:223)
shadow.cljs.repl/repl-require (repl.clj:187)
shadow.cljs.repl/process-read-result (repl.clj:530)
shadow.cljs.repl/process-read-result (repl.clj:510)
shadow.cljs.repl/process-input (repl.clj:673)
shadow.cljs.repl/process-input (repl.clj:651)
shadow.cljs.devtools.server.worker.impl/eval17570/fn--17573 (impl.clj:698)
clojure.lang.MultiFn.invoke (MultiFn.java:234)
shadow.cljs.devtools.server.util/server-thread/fn--17210/fn--17211/fn--17219 (util.clj:283)
shadow.cljs.devtools.server.util/server-thread/fn--17210/fn--17211 (util.clj:282)
shadow.cljs.devtools.server.util/server-thread/fn--17210 (util.clj:255)
java.lang.Thread.run (Thread.java:833)
i can require the namespace several times, then switch to the namespace, run a test. But if i require :reload
from the namespace itself I get an error
I’m running shadow with
:deps {:aliases [:cljs]}
,
and that alias is
:cljs
{:extra-paths ["test" "shared/test"]
:extra-deps
{binaryage/devtools {:mvn/version "1.0.6"}
cider/cider-nrepl {:mvn/version "0.30.0"}
cider/piggieback {:mvn/version "0.5.3"}
cljs-bean/cljs-bean {:mvn/version "1.9.0"}
com.lambdaisland/glogi {:mvn/version "1.2.164"}
io.github.metabase/hawk {:sha "45ed36008014f9ac1ea66beb56fb1c4c39f8342b"}
;; Forcibly targeting a newer release than ships by default with shadow-cljs 2.20.20.
;; It fixes an issue where TypeScript can't parse the `cljs_env.js` output file.
org.clojure/google-closure-library {:mvn/version "0.0-20230227-c7c0a541"}
refactor-nrepl/refactor-nrepl {:mvn/version "3.6.0"}
thheller/shadow-cljs {:mvn/version "2.21.0"}}}
digging into the compiler state, the error says it is not finding the provide
(the namespace symbol) in the :sym->id
map
Looking at the contents of that, that seems to omit the current namespace. So i can require :reload other namespace, and if i require another namespace then the current namespace shows back up
I also think that it’s using my require
forms in the repl and adding those to a dependency graph. It thinks that I’m adding a require to the other namespace and then switching around makes it warn about circularity
why do you say that? I use :reload
in clojure repls. And that ensures that all of the metadata is set correctly on vars (line numbers and such) so doc
and friends work. So I prefer that route. But wondering why you prefer load-file
the require creating a circular require is known, currently there is no separation of requires added by the REPL or code
ok. is that a feature request i can add or just a known limitation of the internals?
(i meant about the circular require issue). I’ll switch to load-file 🙂 . Happy to create any issues that you are interested in tackling (making require work correctly at the repl, the circularity bug, etc)