This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-05-03
Channels
- # aleph (6)
- # announcements (4)
- # babashka (73)
- # beginners (117)
- # calva (25)
- # chlorine-clover (59)
- # cider (21)
- # clara (3)
- # cljdoc (8)
- # cljs-dev (54)
- # cljsrn (15)
- # clojure (65)
- # clojure-france (5)
- # clojure-spec (3)
- # clojure-uk (13)
- # clojurescript (79)
- # conf-proposals (1)
- # conjure (17)
- # core-logic (11)
- # datomic (21)
- # fulcro (82)
- # graalvm (11)
- # helix (7)
- # jobs-discuss (11)
- # joker (2)
- # juxt (3)
- # local-first-clojure (1)
- # luminus (5)
- # nrepl (61)
- # off-topic (12)
- # pathom (70)
- # re-frame (3)
- # reitit (3)
- # rum (1)
- # shadow-cljs (58)
- # sql (1)
- # tools-deps (26)
- # xtdb (3)
The find there is a very easy to reproduce bug when using start-build/stop-build: 1. in a "yarn shadow-cljs clj-repl", run "(shadow/watch-set-autobuild! :app false)", then followed by "(shadow/watch-set-autobuild! :app true)" 2. now the cljs repl won't work anymore
missing cljs.user, repl not properly configured (must have analyzed cljs.user by now) (1/8 results) [30/121]
{}
ExceptionInfo: missing cljs.user, repl not properly configured (must have analyzed cljs.user by now)
could be fixed by commenting out two lines:
--- a/src/main/shadow/cljs/devtools/server/worker/impl.clj
+++ b/src/main/shadow/cljs/devtools/server/worker/impl.clj
@@ -772,8 +772,8 @@
;; compile immediately, autobuild is then checked later
(-> worker-state
(assoc :autobuild true)
- (build-configure)
- (build-compile)
+ #_(build-configure)
+ #_(build-compile)
)))
Could anyone share how they work with logging (for debugging) using shadowcljs on Node? js/console.log sucks to print clojure map I found reference to shadowcljs inspect, which seems nice, but I can't make it work any other suggestions?
@UV2730B5K You could try chrome + https://github.com/binaryage/cljs-devtools
Personally, I connect a REPL and put (def foo foo) inside fns I want to debug. then just repl.
basically the same flow as scope-capture on the jvm. I can’t figure out how to use it on node
also this lib is great for digging into js objs https://github.com/applied-science/js-interop
@U4YGF4NGM Are you sure? I could have sworn I’ve used it with node before.
(to be more precise, shadowcljs inspect works in the repl, but not inside a test (deftest))
inspect just works based off tap> so it should work everywhere that the shadow.remote runtime runs. if you use :node-test
that won't work currently since it immediately exits after running the tests.
When I make any changes in my app, shadow seems to rebuild the app (the build message is shown in the repl), but I see the following:
scheduler.development.js:108 Uncaught TypeError: lastCallbackNode is not a function
at flushFirstCallback (scheduler.development.js:108)
at flushWork (scheduler.development.js:220)
at MessagePort.globalValue.port1.onmessage (scheduler.development.js:612)
in the console, and when I refresh the page, the app still seems to be in the older state. How do I fix this?Hi! Is it possible that when I'm importing namespace like (ns
shadow just removes this namespace? I have a macro in it that should run some code on first namespace load and it doesn't seem to be ever triggered.
@bear-z no shadow-cljs will never remove a require. relying on a macro side effect is a bad idea since the behavior will be different depending on many factors like parallel compilation and caching
I think I don't understand how require works. If in the namespace impored.but.never.used
I have a js/console.log at the top level, should it fire when I require it for the first time?
require means that the runtime will ensure that the required namespace will be loaded before the namespace that required it
And when namespace is loaded then any code that is not wrapped in function should be executed right away?
@wxitb2017 please report reproducible bugs to the shadow-cljs github. reports just get lost in slack.
https://github.com/thheller/shadow-cljs/issues/700 https://github.com/thheller/shadow-cljs/pull/701
hi, I see this in logs after code is reloaded, but code reloaded just fine, I can see changes in the UI
looks like an error from metro? did you disable every kind of reload provided by metro directly?
mhm, yeah sounds reasonable, so its something related to metro
not shadow, thanks, probably we shouldn't watch js changes because we don't use react native reload
@andre how do you like viz.js? I've been meaning to add a nice namespace dependency graph to the shadow-cljs UI but so far haven't found anything that is actually readable in larger projects. is viz.js useful or rather stay away?
I've never worked with such libs, so I looked a few, and kinda liked this one, because of simple API, lots of configurations if needed, dynamic nodes and edges, haven't had any issues with it, renders pretty fast and smooth, so for re-frisk it was a best fit , though I haven't tried other libraries, I'm totally fine with this one 🙂
I'm suddenly getting the error
The required namespace "" is not available, it was required by "cljs/util.cljc".
"clojure/java/io.clj" was found on the classpath. Maybe this library only supports CLJ?
For a bootstrap build. Is it possible to see where the cljs.util
namespace is being brought in somehow?After that I get
The required namespace ".File" is not available, it was required by "cljs/util.cljc".
which doesn't seem to be "cured" by creating a File.cljs (actually I tried http://clojure.io.File, not http://java.io.File). Edit: ok tried both and neither works
hi, I'd like to bundle a node-script target including their dependencies into a single js-file (via :js-provider
:shadow
). It's working, but I have to specify the entirety of the node standard library in :js-options
:resolve
to be already included, which doesn't seem to be the right way to go. Anything else I can do?
@ak407 I recommend just post-processing the file with something like https://github.com/zeit/ncc without any :resolve
config
How do you access process.env
in a Node script? (:-env js/process)
is returning nil
for me.
ClojureScript 1.10.597
cljs.user=> (.-env js/process)
#object[Object [object Object]]
i think your interop is off. you want .-
not :-
:-env
is a keyword so invoking that is looking up in js/process
for an entry at that keyword
and to be a bit more precise :-env
is trying to look up something at that key, finding a non-associative object and returns nil.
This leads to my next question… Is it possible to have a development only file (ignored in SCM) like secrets.edn
, and then have a release version that uses (.-env js/process)
?
secrets.edn
example: {:api-key "asdfasdf1234"}
Then in release build {:api-key (.. js/process -env -API_KEY)}
How would you do it? Can you have a development only source path? In node I would usually use dotenv
https://shadow-cljs.github.io/docs/UsersGuide.html#closure-defines are useful. At dev time you define a debug/development boolean and when that's set, read in dev-config.edn. otherwise use env or read prod-config.edn