When I have a local npm dep and make changes to it, can I get reloading for that, or do I have to npm install + restart my build process every time?
@borkdude shadow-cljs no longer watches individual files in node_modules
(there were just tooooo many). you can touch node_modules/that-package/package.json
though to trigger a recompile
thanks!
or in case you are writing the whole thing yourself anyways just go with direct includes via https://shadow-cljs.github.io/docs/UsersGuide.html#classpath-js
will this JS also be optimized when building with release?
yep
:thumbsup: :)
even going through :advanced
unlike node_modules
which is only :simple
First project using shadow (inherited from @plexus) https://babashka.org/xterm-sci/
hmm why xterm?
dunno :)
it was plexus's idea, I thought I'd take a stab at it, since he was using implementation details of sci, I forced myself into making those things public
otherwise, it could have just been a text area probably
nah I mean that we can probably do better than a text-only interface these days ๐
I'm sad if that is the best we can do
well the shadow-cljs UI is at least my attempt to do better ... not yet sure if it actually is ๐
sure
maybe a codemirror input (or any editor) and outputting some kind of DOM is better than xterm
that wasn't the point of this exercise from my angle, I'm sure there are lots of nice things you can do visually
yes, I already have that here: https://borkdude.github.io/sci.web/ (this is an older version of sci, I should update it)
I played with xterm too in the UI a while ago. it is definitely a decent way to get a functional terminal-ish interface going quickly
@thheller I used local-echo but it had issues with quoting. Made an issue + fix for it
there is also a linefeed issue. (dotimes [x 1000] (prn x))
(might be because I'm on windows?)
81
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
nil
user=> ^C
user=>
I vaguely remember having that problem too before
thanks, I'll make an issue about it
yeah, I know what the issue is actually. I'm only replacing the last \n with \r\n (which the terminal needs), not the intermediate ones
I think I should support *print-fn*
in sci instead of only *out*
which works better for CLJS
In this REPL I'm flushing everything first to a buffer and print it at the end which is kind of sub-optimal
The issue is registered
hi, I'm trying to figure out why a simple access works in development mode and not with release.
(re-frame/reg-event-db
::check-web3
(fn-traced [db [_ js-window]]
(let [web3-enabled (exists? (.-ethereum js-window))]
(js/console.log (str "Browser is web3? " web3-enabled " " (.-ethereum js-window) " " js-window))
(assoc db :web3-enabled? web3-enabled))))
I'm trying to check for window.ethereum which is a proxy object added by http://MetaMask.io extension .the code woeks with lein watch but fails to work when I do lein release
and load the app via static server
maybe an advanced compilation problem which renames that property access
@eugen.stan I think your best bet with property access in CLJS in general may be goog.object/get
thanks @borkdude. I am a bit surprised because the use case seems simple. I just started a build with disabled optimisations
another good library for this is https://github.com/applied-science/js-interop
yes, it is an optimisation issue. Thanks @borkdude. I'll reread the docs.
Adding the ^js
type hint fixes the issue with advanced compilation (fn-traced [db [_ ^js js-window]]
.
Thanks again.
For some reason, I had to add com.google.guava/guava {:mvn/version "23.0"}
manually to my deps today, because of:
[2020-09-15 12:49:30.646 - WARNING] :shadow.cljs.devtools.server.util/handle-ex - {:msg {:type :start-autobuild}}
NoClassDefFoundError com/google/common/collect/Streams
com.google.javascript.jscomp.deps.DependencyInfo$Require.asSymbolList (DependencyInfo.java:60)
com.google.javascript.jscomp.deps.DependencyInfo$Base.getRequiredSymbols (DependencyInfo.java:163)
com.google.javascript.jscomp.Compiler.findModulesFromInput (Compiler.java:1914)
com.google.javascript.jscomp.Compiler.findModulesFromEntryPoints (Compiler.java:1870)
com.google.javascript.jscomp.Compiler.parseInputs (Compiler.java:1679)
com.google.javascript.jscomp.Compiler.parseForCompilationInternal (Compiler.java:954)
com.google.javascript.jscomp.Compiler.lambda$parseForCompilation$4 (Compiler.java:937)
com.google.javascript.jscomp.CompilerExecutor.runInCompilerThread (CompilerExecutor.java:129)
com.google.javascript.jscomp.Compiler.runInCompilerThread (Compiler.java:843)
com.google.javascript.jscomp.Compiler.parseForCompilation (Compiler.java:935)
com.google.javascript.jscomp.Compiler.compile (Compiler.java:693)
jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (NativeMethodAccessorImpl.java:-2)
Caused by:
ClassNotFoundException com.google.common.collect.Streams
jdk.internal.loader.BuiltinClassLoader.loadClass (BuiltinClassLoader.java:581)
jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass (ClassLoaders.java:178)
java.lang.ClassLoader.loadClass (ClassLoader.java:522)
com.google.javascript.jscomp.deps.DependencyInfo$Require.asSymbolList (DependencyInfo.java:60)
com.google.javascript.jscomp.deps.DependencyInfo$Base.getRequiredSymbols (DependencyInfo.java:163)
@henrik typical dependency conflict. you may want to investigate where this conflict is from, otherwise the other code depending on the other version may have issues.
Gotcha @thheller. Only mention of Guava seems to be from dev-local, maybe thatโs the culprit.
com.datomic/dev-local 0.9.195
com.google.errorprone/error_prone_annotations 2.3.4
com.datomic/client-api 0.8.54
com.cognitect/anomalies 0.1.12
com.google.guava/listenablefuture 9999.0-empty-to-avoid-conflict-with-guava
yeah datomic is a common cause
Why canโt we just be friends
thats fine
looks like you are on an older shadow-cljs version?
2.11.4
ah right. the check is still running but you can ignore it. you may want to consider keeping your CLJ deps out of your CLJS alias
Didnโt know that goods practice. Iโm on a pretty cljc-heavy codebase, might be a bit finicky?
don't know. I keep my stuff usually completely separate. CLJS managed by shadow-cljs.edn only and CLJ by project.clj
depends on how you project is organized I guess
Yeah, itโs just laziness talking. It sounds like a good thing to do.
if I were to use deps.edn only I'd have a :frontend
alias and a :backend
alias
just to avoid conflicts like these .. you won't be using REBL or dev-local in your CLJS builds anyways
@thheller printing issue should be fixed:
(run! prn (range 500))
https://babashka.org/xterm-sci/