This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-06-03
Channels
- # announcements (6)
- # babashka (14)
- # beginners (17)
- # biff (3)
- # calva (19)
- # circleci (3)
- # clj-on-windows (1)
- # cljdoc (21)
- # cljs-dev (6)
- # clojure (119)
- # clojure-australia (2)
- # clojure-europe (28)
- # clojure-france (3)
- # clojure-norway (12)
- # clojure-survey (2)
- # clojure-uk (7)
- # clojurescript (25)
- # core-typed (1)
- # cursive (11)
- # datomic (53)
- # emacs (14)
- # events (1)
- # gratitude (1)
- # holy-lambda (21)
- # integrant (2)
- # jobs (1)
- # jobs-discuss (3)
- # juxt (3)
- # kaocha (1)
- # lsp (17)
- # nbb (14)
- # off-topic (25)
- # pathom (11)
- # re-frame (24)
- # releases (1)
- # remote-jobs (2)
- # rewrite-clj (10)
- # shadow-cljs (11)
- # sql (3)
- # tools-build (6)
- # tools-deps (83)
- # vim (26)
- # xtdb (10)
Anyone have a preferred method of rendering colored code blocks with line numbers in hiccup?
Hey all - I am attempting to test #sicmutils’s build with this https://github.com/henryw374/clojurescript-library-consumers-test project, and I’m hitting an error that I do NOT see with shadow-cljs compilation:
SEVERE: /Users/sritchie/code/clj/clojurescript-library-consumers-test/cljsjs/out/sicmutils/numbers.js:389:7: ERROR - [JSC_LANGUAGE_FEATURE] This language feature is only supported for ECMASCRIPT_2016 mode or better: exponent operator (**).
389| return a ** b;
has anyone seen this before?The issue is definitely coming from
(defmethod g/expt [js/BigInt js/BigInt] [a b]
(if (g/negative? b)
(g/invert (js* "~{} ** ~{}" a (core/- b)))
(js* "~{} ** ~{}" a b)))
Check the target version for closure compiler. By default, it compiles to a very old ecmascript version.
@sritchie09 I think you need to set :lang-in
- shadow probably just picks a later one by default
@dnolen okay nice, stumbled on that now and that works. I’m assuming there’s no way to specify in a library that consumers need to set :language-in :es-2016
, yeah? I’ll add a note to the docs
@sritchie09 open a JIRA ticket if you can to set this as default, patch also welcome
filed a ticket for a contributor account, patch is simple
IMHO its fine to set language-in as the highest possible option. shadow-cljs has had this at :es-next-in
(or :es-unstable
now) since the beginning. never had an issue with that. doesn't seem to affect any of the polyfill generation. they are controlled by language-out
Wdyt @dnolen ? I can submit patches now so happy to make the ticket
@dnolen will do in a couple hours! newborn twins at home fragmenting time 🙂 but I’m not going to miss my first chance at a patch, however small
I started experimenting with reagent and shadow-cljs and the bundle size of my extremely naive project surprises me. I basically only render a [:h1 "Hello"]
and do nothing else. I found the option to create a build report, I'll attach it in a thread. There I could see that react-dom
is >100kb which makes me think I'm doing something wrong.
shadow-cljs - starting via "clojure"
| Resource | Optimized | Total % | JS | Source |
|--------------------------------------+-------------+----------+-------------+-------------|
| npm | react-dom | 120.2 KB | 43.60 % | 120.5 KB | 122.2 KB |
| jar | cljs/core.cljs | 116.9 KB | 42.39 % | 1.3 MB | 348.0 KB |
| npm | react | 6.2 KB | 2.24 % | 6.2 KB | 6.8 KB |
| jar | reagent/impl/component.cljs | 6.1 KB | 2.21 % | 26.6 KB | 17.0 KB |
| jar | reagent/ratom.cljs | 5.8 KB | 2.09 % | 59.3 KB | 17.3 KB |
| npm | scheduler | 4.6 KB | 1.67 % | 4.6 KB | 5.2 KB |
| jar | reagent/impl/template.cljs | 4.4 KB | 1.60 % | 25.8 KB | 11.2 KB |
| jar | reagent/impl/util.cljs | 2.2 KB | 0.81 % | 31.1 KB | 6.8 KB |
| jar | reagent/impl/batching.cljs | 1.8 KB | 0.64 % | 7.5 KB | 3.1 KB |
| jar | reagent/impl/input.cljs | 1.7 KB | 0.60 % | 6.0 KB | 5.8 KB |
| jar | clojure/string.cljs | 1.0 KB | 0.38 % | 14.7 KB | 8.4 KB |
| npm | object-assign | 993.0 B | 0.36 % | 994.0 B | 2.2 KB |
| jar | reagent/impl/protocols.cljs | 948.0 B | 0.34 % | 4.9 KB | 194.0 B |
| jar | clojure/set.cljs | 532.0 B | 0.19 % | 14.3 KB | 5.0 KB |
| jar | goog/object/object.js | 508.0 B | 0.18 % | 21.4 KB | 21.4 KB |
| jar | shadow/js.js | 495.0 B | 0.18 % | 3.2 KB | 3.2 KB |
| jar | reagent/dom.cljs | 471.0 B | 0.17 % | 7.0 KB | 2.7 KB |
| jar | goog/string/stringbuffer.js | 308.0 B | 0.11 % | 2.3 KB | 2.3 KB |
| jar | goog/base.js | 241.0 B | 0.09 % | 128.7 KB | 128.7 KB |
| | gomore/app.cljs | 168.0 B | 0.06 % | 661.0 B | 559.0 B |
| | shadow/module/main/append.js | 89.0 B | 0.03 % | 118.0 B | 118.0 B |
| jar | goog/string/string.js | 81.0 B | 0.03 % | 47.8 KB | 47.8 KB |
| jar | goog/string/internal.js | 40.0 B | 0.01 % | 12.3 KB | 12.3 KB |
| jar | reagent/debug.cljs | 9.0 B | 0.00 % | 2.9 KB | 614.0 B |
For reference, this is my shadow-cljs.edn
{:deps
{:aliases [:cljs]}
:dev-http
{8020 "packs"}
:builds
{:app
{:target :browser
:output-dir "packs/cljs"
:asset-path "/packs/cljs"
:modules
{:main
{:init-fn
:compiler-options {:optimizations :advanced}}}}}}
react-dom
is just that large: https://bundlephobia.com/package/[email protected]
GZipping it, as the page suggests, would reduce the size significantly. And if you really care about the bundle size, you might be interested in React replacements that preserve [some of] the API and are generally compatible with Reagent. But I wouldn't suggest that for a beginner.
Alternatively, you can replace Reagent with something else entirely, something that's not React-based. Finally, just as some food for thought - it all depends on your particular application, but 120-130 kB is almost nothing. Usually even a random picture takes much more space.
Oh that's a nice page, thanks for looking this up! Yeah you're right, it's not that bad. Just out of curiosity, what are those replacements?