This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-02-09
Channels
- # announcements (19)
- # babashka (26)
- # beginners (157)
- # calva (54)
- # cider (12)
- # clj-kondo (18)
- # cljdoc (3)
- # clojure (65)
- # clojure-australia (3)
- # clojure-europe (28)
- # clojure-germany (14)
- # clojure-greece (1)
- # clojure-italy (8)
- # clojure-nl (10)
- # clojure-uk (81)
- # clojuredesign-podcast (2)
- # clojurescript (20)
- # clr (1)
- # conjure (1)
- # cursive (1)
- # data-science (29)
- # datascript (2)
- # datomic (19)
- # depstar (4)
- # fulcro (24)
- # graalvm (6)
- # helix (26)
- # jobs (2)
- # jobs-discuss (2)
- # kaocha (12)
- # leiningen (1)
- # malli (17)
- # off-topic (18)
- # pathom (34)
- # polylith (23)
- # re-frame (10)
- # reagent (8)
- # releases (1)
- # remote-jobs (1)
- # reveal (5)
- # shadow-cljs (49)
- # spacemacs (1)
- # startup-in-a-month (6)
- # vim (4)
hey there - I'm trying to understand what's happening with *print-fn*
such that if I print something from a function in the browser, I'll see that output in my repl. I can see that *print-fn*
appears to be bound to the same thing (?) in both the client and the repl, but the behaviour diverges.
if I (prn :foo)
from a connected repl, I see the output in the repl and the browser console, but if I do the same thing from a function (eg reagent component), then i only see it in the console.
it is just an artifact of most nrepl clients not accepting output that is not tied to a specific evaluation
shadow-cljs does capture the prints, it just has nowhere to send them in case of nrepl
thanks @U05224H0W
some kind of plumbing for a connected build would be pretty neat, getting prints back from the client
shadow-cljs does not capture arbitrary prints outside the nREPL evaluation. pretty sure no CLJS REPL does
Hello 👋 Is it expected that release
build won't write into location specified in {:release {:output-to "..."}}
?
depends. which :target
are you talking about? :output-to
for example is not an option for :browser
:target :browser
ah, so there's no way to specify output-dir per module?
no, it is by design that all :modules
should live in the same directory. otherwise complicates things with loader and source maps and so on
got it :thumbsup: what about compiler namespaces, are they written into :output-dir
as well when running release
?
no, in case you mean the cljs-runtime
dir you otherwise get with watch
or compile
output
perfect! thanks 🙏
btw, are there any docs on how shadow bundles NPM deps? is it using own bundler? does it split npm deps together with cljs splits?
https://code.thheller.com/blog/shadow-cljs/2018/06/15/why-not-webpack.html has some background info on how things work
thanks! I have some more questions if you don't mind: what about DCE? does it exist, is it on par or better than webpack? what happens with NPM deps when compiling with advanced optimizations?
I might add it at some point but currently everything is pretty webpack specific so even other JS bundlers struggle with it
I see. So how's JS deps are included into cljs splits then? Does shadow splits NPM deps into modules based on requrie's from cljs code and then prepends JS splits to CLJS ones?
but its file based not module based, so even if they are in the same package they might end up in different modules depends on how you use them
https://code.thheller.com/blog/shadow-cljs/2017/11/10/js-dependencies-in-practice.html
cool! thanks :thumbsup:
does anyone know of a reference architecture/starter kit for clojurescript that has typescript interop? Would this be interesting to anyone?
I got to code splitting and hitting an issue now: goog is not defined
the setup is simple: there's module A and module B that depends on A, when A is loading the exception is thrown
should mention it happens in release build with advanced optimizations
the line where it fails is goog=goog||{}
which I guess comes from goog's base.js
hmm, good point, might be something coming from a library, let me see, thanks
here's code block around that line compiled with :pseudo-names true
$APP.$JSCompiler_stubMap$$ = [];
goog = goog || {};
$goog$global$$ = this || self;
$goog$NONCE_PATTERN_$$ = /^[\w+/_-]+[=]{0,2}$/;
$goog$cspNonce_$$ = null;
$goog$UID_PROPERTY_$$ = "closure_uid_" + (1E9 * Math.random() >>> 0);
$goog$uidCounter_$$ = 0;
$APP.$goog$now$$ = Date.now || function() {
return +new Date
}
;
$goog$evalWorksForGlobals_$$ = null;
$APP.$goog$inherits$$($goog$debug$Error$$, Error);
is that something that shouldn't be there after advanced?
which versions do you use? make sure it all matches properly. using mismatched closure compiler, CLJS or shadow-cljs versions causes all sorts of weird issues
shadow 2.10.21 cljs 1.10.773
in a regular build it should be something like var da=da||{}
or pseudo-named var $goog$$ = $goog$$ || {}
huh, actually I'm building using shadow from NPM of one version and requiring shadow's loader, which is coming from shadow of another version declared in deps.edn, should fix that as well