> > Thomas, my concern with using :modules is polluting the global scope. We > deliver code for other companies to run on their websites and putting > multiple variables on the global scope is too risky. That being said, maybe > I can wrap each module's code in a function that aliases `window` - I > haven't explored that avenue much. >
It is possible to isolate the globals and only create one, that however comes at the cost of a few extra bytes for each variable that would otherwise become a global (eg. var foo; becomes $CLJS.foo). See :rename-prefix-namespace compiler option. > When I last looked at where the KBs come from using > https://github.com/danvk/source-map-explorer there were not many > surprises - a lot of the size came from closure's libs, clojurescript.core, > and my application code. The only third party libs I'm still using are > preact and reagent. > Since CLJS is missing all source maps of foreign-libs they will not show in source-map-explorer, so make sure your "bytes" are fully accounted for and not accidentally including something that shouldn't be (usually indicated by a big blank area). shadow-cljs generates far more accurate build reports [1][2] for JS stuff but CLJS is mostly the same so if thats where all the bytes are coming from it won't show anything more. > I agree about cljs being competitive and providing something much better > than what we get with plain js. Sadly, telling customers that our script is > bigger because we use a better programming language doesn't always satisfy > them. ¯\_(ツ)_/¯ > They might care about better code quality which CLJS tends to have (IMHO). ;) [1] https://shadow-cljs.github.io/docs/UsersGuide.html#_build_report [2] https://code.thheller.com/demos/build-report/huge.html -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojurescript+unsubscr...@googlegroups.com. To post to this group, send email to clojurescript@googlegroups.com. Visit this group at https://groups.google.com/group/clojurescript.