This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-07-15
Channels
- # announcements (3)
- # aws (2)
- # babashka (57)
- # beginners (24)
- # clj-kondo (5)
- # clj-together (3)
- # cljs-dev (11)
- # clojure (83)
- # clojure-australia (1)
- # clojure-china (1)
- # clojure-europe (32)
- # clojure-filipino (1)
- # clojure-hk (5)
- # clojure-indonesia (1)
- # clojure-japan (1)
- # clojure-korea (1)
- # clojure-my (1)
- # clojure-nl (1)
- # clojure-norway (1)
- # clojure-sg (1)
- # clojure-spain (1)
- # clojure-taiwan (1)
- # clojure-uk (2)
- # clojurescript (7)
- # conjure (36)
- # data-science (19)
- # datomic (27)
- # emacs (44)
- # events (4)
- # fulcro (16)
- # honeysql (6)
- # inf-clojure (1)
- # interop (5)
- # malli (5)
- # nbb (1)
- # off-topic (19)
- # pathom (4)
- # practicalli (1)
- # remote-jobs (4)
- # ring (1)
- # shadow-cljs (72)
- # spacemacs (2)
Hi. I'm experimenting with react-table and am curious if there's a way to get exceptions thrown using non-minified library code. For example, when doing something wrong, I receive an exception like this:
index.production.js:22 Uncaught Error
at s$jscomp$0 (index.production.js:22:1173)
at eval (index.production.js:22:4096)
at Array.map (<anonymous>)
at t (index.production.js:22:4096)
at W.e$jscomp$2.getAllColumns.a$jscomp$2.key (index.production.js:22:4096)
at Object.eval [as getAllColumns] (index.production.js:22:477)
at eval (index.production.js:22:2390)
at Object.eval [as getHeaderGroups] (index.production.js:22:365)
at Function.compute$ui$components$rtable$Table_STAR_ (rtable.cljs:28:27)
at Function.eval [as cljs$core$IFn$_invoke$arity$3] (core.cljs:3935:15)
The stacktrace points to lines in the depths of a minified line in the file /node_modules/@tanstack/react-table/build/umd/index.production.js
. The process of debugging is a game of guess and check since it's non-obvious what code is failing there. In that same /node_modules/@tanstack/react-table/build/umd
directory, I see an index.development.js, and I'm wondering if I could tell shadow to switch to that in hopes the stacktrace becomes usable during development.you can use :resolve
to control what gets included https://shadow-cljs.github.io/docs/UsersGuide.html#js-resolve
so :js-options {:resolve {"@tanstack/react-table" {:target :npm :require "@tanstack/react-table/build/umd/index.development.js"}}}
I'm trying to convert a project over to use shadow-cljs, but the compilation process blows up when it tries to load babashka.sci
. In order to narrow down the problem, I've got it down to this repro:
npx shadow-cljs browser-repl
# wait for the repl to come up
(require '[sci.core :as sci])
ExceptionInfo Failed to process REPL command {:eof? false, :ns cljs.user, :form (require (quote [sci.core :as sci])), :source "(require '[sci.core :as sci])", :tag :shadow.cljs.repl/process-ex}
shadow.cljs.repl/process-read-result (repl.clj:504)
shadow.cljs.repl/process-read-result (repl.clj:478)
shadow.cljs.repl/process-input (repl.clj:641)
shadow.cljs.repl/process-input (repl.clj:619)
shadow.cljs.devtools.server.worker.impl/eval82029/fn--82032 (impl.clj:698)
clojure.lang.MultiFn.invoke (MultiFn.java:234)
shadow.cljs.devtools.server.util/server-thread/fn--81669/fn--81670/fn--81678 (util.clj:269)
shadow.cljs.devtools.server.util/server-thread/fn--81669/fn--81670 (util.clj:268)
shadow.cljs.devtools.server.util/server-thread/fn--81669 (util.clj:241)
java.lang.Thread.run (Thread.java:829)
There's a long stacktrace, which points to a null pointer while trying to compile sci.
I'm not sure the best place to ask, here or sci, so I thought I'd start here with the repl command error
A repro would be most helpful, in the form of a repository that we can clone locally
This will automatically answer questions like: which version of SCI, etc, etc are you using
:thumbsup: , I'm on the latest version of sci and shadow, but I'll try to put together a repro repo
you could also try wiping your .shadow-cljs
and see if this helps. If that does help, then use the latest SCI commit on master
if wiping .shadow-cljs does not help, then it's probably not the problem we discussed recently
well if sci never properly declares a dependency on the analyzer stuff there is no guarantee it'll be compiled "before" sci
so it may still be compiling given that :parallel-build
defaults to true and another thread might still be working on it
although you are not compiling the self host version by default? the CLJ parts should all be loaded given that shadow-cljs uses them
Oh wait, my code doesn't use copy-var at all, just create-ns
new-var
init
parse-string
eval-string*
and eval-form
. The NPE happens when trying to compile SCI. Also, it does compile just using the cljs compiler. Could you clarify what I should bisect through?
I've picked up this problem again, and unfortunately I can't reproduce it in a basic shadow-cljs project with just the sci library. So, my question is: what sort of reasons would make this nondeterministic? Given my naive reproduction isn't reproducing it, but it stubbornly persists in the actual project.
I don't think it's non-deterministic necessarily, you should just keep working on a repro
until the error disappear and then start adding things back, this might give you some clues
I've sliced and diced my project and it just tosses the NPE as soon as I add the sci.core
require. I've removed every use of sci, and it's the require that causes the NPE.
I'm not sure where to go from there - it's literally the same jar from my .m2 cache, same version of shadow-cljs, same version of clojure and clojurescript
if the code is private, you could add me temporarily as a contributor. else I wouldn't know how to help you further.
The repo is public, let me add some local work to the branch and push it so you can see.
Alright, check out the feature/shadow-cljs
branch if you can spare the time: https://github.com/dpetran/db
@winsome I'm getting:
[:browser] Compiling ...
The required JS dependency "process" is not available, it was required by "node_modules/js-sha3/src/sha3.js".
I have shadow npm installed as a devDependency. FWIW, I have seen that error before, but not currently. Maybe I need to clear my caches.
@winsome It seems to be something in 0.3.32 and/or with CLJS newest - it works with 0.3.31.
Although outside your project this works fine:
clj -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version "1.11.60"} org.babashka/sci {:mvn/version "0.3.32" }}}' -M:dev -m cljs.main -re node
cljs.user=> (require '[sci.core])
nil
Inside your project the above works with 0.3.31 but not with 0.3.32. Not sure why, perhaps an interaction with shadow or so
Ah, if I remove the specific clojurescript version from your project, then 0.3.32 also works
Thanks for investigating! I'll downgrade for now - does 0.3.32 have anything critical?
Perhaps it's something with shadow + a specific clojurescript version that pulls in some conflicting things. @U05224H0W might know
I think I'm happy to depend on shadow to do things unless I hear otherwise. Thank you for your time and problem solving!
I've picked up this problem again, and unfortunately I can't reproduce it in a basic shadow-cljs project with just the sci library. So, my question is: what sort of reasons would make this nondeterministic? Given my naive reproduction isn't reproducing it, but it stubbornly persists in the actual project.