This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-02-12
Channels
- # adventofcode (1)
- # announcements (6)
- # babashka (28)
- # beginners (75)
- # calva (8)
- # clj-commons (4)
- # clojure (39)
- # clojure-austin (5)
- # clojure-europe (7)
- # clojurescript (14)
- # clr (3)
- # datalevin (2)
- # fulcro (7)
- # funcool (1)
- # graphql (4)
- # helix (3)
- # hyperfiddle (5)
- # joyride (15)
- # malli (1)
- # missionary (16)
- # practicalli (1)
- # releases (1)
- # reveal (2)
- # tools-deps (14)
- # vim (9)
I'm trying to understand code splitting with shadow-cljs https://shadow-cljs.github.io/docs/UsersGuide.html#CodeSplitting.
I want to keep my app multi-paged to keep things familiar for me, but I have some pages where I need some interactivity.
I think how code splitting is described is what I want. But I'm not sure I understand what is meant by the :shared
module. Does it mean if home
, login
, and protected
require something from common
(via ns
)? Or would require
s get compiled into each module and shared
is something else?
I guess what I'm asking is, do I need to copy-paste the :require
d namespaces in my cljs
files in the :shared
module definition?
I think I got it working. So I left :shared
empty as mentioned in the 'tip'. And I added both the shared.js
and login.js
scripts in the html page.
did you see https://code.thheller.com/blog/shadow-cljs/2019/03/03/code-splitting-clojurescript.html?
ah that's specifically talking about splitting/lazy-loading React components.
How should I approach splitting without Reagent/React?
e.g. I want to compile self-contained scripts that are only needed in specific pages.
Would I need separate :builds
entries for each script?
Does that end up with each build having some duplication of the Clojurescript runtime?
you can just load them directly via html script tags, no need to load them dynamically driven by react components