This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-10-07
Channels
- # announcements (10)
- # architecture (25)
- # babashka (5)
- # beginners (95)
- # calva (1)
- # cider (3)
- # clerk (16)
- # clj-on-windows (41)
- # clojure (64)
- # clojure-europe (7)
- # clojurescript (9)
- # deps-new (2)
- # graalvm (25)
- # honeysql (3)
- # hyperfiddle (19)
- # malli (1)
- # meander (5)
- # music (1)
- # nbb (1)
- # off-topic (54)
- # rdf (10)
- # releases (2)
- # shadow-cljs (12)
- # tools-deps (41)
Is there some way to get ClojureScript to emit a single un-optimised file? This would reduce the live reload delay in my workflow. I am trying to write a traditional website in Clj+Cljs. Updates to HTML require a page reload, which takes many seconds to complete, on account of the many Javascript files the page has to load. At this point I'm thinking maybe a) I have missed a memo and/or am doing something silly (I'm not a web developer), or b) Cljs is better suited for SPA-type apps, and I should use plain ol' Javascript or htmx if I want to write good ole websites. Backstory and full context: https://clojurians.slack.com/archives/C053AK3F9/p1696532352290479
Why is having 200+ files a problem in the first place?
The very first load - sure, should be slow. The next load should use the cache anyway.
When you change some CLJS file, compilation artifacts that are not affected will not be changed. I have .js
files in my target/dev
dir dating back to May (I must've removed the whole target
back then for some reason).
Regarding the X question - this comment and a short discussion that follows are relevant: https://clojurians.slack.com/archives/C6N245JGG/p1640872697398800 So if you can't make the cache work and decide to go that route, seems like it would make sense to have some debouncing in place or trigger the build manually.
Also, as a potential solution - in case your code doesn't really require a full page reload and only needs some state to be cleared along with the JS code to be updated, then you can use whatever we the SPA guys are using, without React or anything or the sort. At least shadow-cljs provides hooks that can be used to trigger any code, e.g. code that resets the internal state of the page to the initial one. But it wouldn't help much if you also change the HTML output, of course.
shadow-cljs does not load 200 individual files on startup, not since https://clojureverse.org/t/improving-initial-load-time-for-browser-builds-during-development/2518 (which has been the default for many years now)
so I'm guessing @U051MHSEK doesn't use shadow-cljs and is still experiencing the "old slow ways" 😉
Hm, I was holding on to hope that out-of-the box developer experience would be salvageable. I guess there is no way to avoid a whole bunch of tooling dependencies when using ClojureScript. I will give shadow-cljs a spin, for the sake of completeness. But I will probably switch to plain JavaScript for my purposes.