we're working on adding an :npm-module
output into a webpacked js frontend at work. One footgun is that forgetting to mark things with ^:export
has no consequence during dev time but is obviously catastrophic at release time. Is it possible to have the dev build munge names so that we can kinda feel this pain under dev settings and not just in CI or (gasp) released?
@dpsutton no, the closure compiler does the munging and that is not used in dev builds
you might want to use :target :esm
. there the exports are configured in the build config so no ^:export
there
yeah that builds up a big build config so probably better to just go with ^:export
also, is there a way to get around enumerating every namespace in the :entries
vector? Basically everything will be compiled either directly or transitively so would be nice to just get all namespaces for free.
i was a cljs dev for 3 or so years and i'm excited that i'll finally be able to use shadow in a work product. its all been lein-figwheel because the projects were set up when that was the only game in town and wasn't worth changing over
@denik that is not possible if you want to use :advanced
optimizations (which you should for browser builds). with one small adjustments you can just interpret the EDN though: turn functions into actual data. for [example](https://github.com/thheller/shadow-cljs/blob/f0a2ae8e9cfdbadc19641bd89327b3fb496733d3/src/main/shadow/cljs/ui/components/inspect.cljs#L107) in the stuff I'm building you'd say :on-click {:e :some.ns/foo! :with "some" :other "args" :maybe true}
(just data). yes that limits you to only using events that already exist but that might be enough for you
@dpsutton I recently changed the logic back so that an emptry :entries []
is allowed again
that'll just give you all found namespaces
oh nice. i saw a spec error that indicated it needed at least one simple simple. maybe we need a newer version
@denik I did something very similar for fun. I had a re-frame on the front. Using sente I both passed hiccup data that was written to the db, and instead of sending functions, I sent re-frame event keys. If you wanted to send functions though, you could use sci
reagent interprets hiccup in runtime, so you can fetch data from the db and simply render it when received.
@thheller you recomment letting shadow bring in the ClojureScript dep, correct? Asking because I want to give https://github.com/clojure/clojurescript/commit/715cdc07dbb1d595af91ea12affb6faf0b615d4b a try
do you expect issues when requiring a cljs version explicitly?
seeing this now:
Syntax error (ClassNotFoundException) compiling at (shadow/build/closure.clj:1:1).
com.google.javascript.jscomp.AnonymousFunctionNamingPolicy
oh, I see thatโs fixed by bumping shadow and getting https://github.com/thheller/shadow-cljs/commit/d0451aba279689bc74ae5340e83b2466e4bdb237
it might work if you use master
yes. I still haven't checked all the closure-library/compiler related changes and verified they work
that AnonymousFunctionNamingPolicy
issue is fixed but there might be others I'm not yet aware of since the closure-lib has undergone some rather big changes too
I'll likely test the CLJS master myself later or tomorrow if you want to wait ๐
makes sense. thanks @thheller!
interesting idea to use sci! Iโll ponder it
tested CLJS master
with the latest closure-compiler and library and everything appears to work fine