Fork me on GitHub

Hi hopefully someone can help me out. I'm experimenting with shadow-cljs potentially to replace boot. I run shadow-cljs watch app (where app is browser target) . I receive the following errors

The required namespace "cljsjs.material-ui" is not available, it was required by "cljs_react_material_ui/core.cljs"
The required namespace "cljsjs.material-ui-svg-icons" is not available, it was required by "cljs_react_material_ui/icons.cljs"
I create the following cljsjs stubs.
(ns cljsjs.material-ui
  (:require ["material-ui" :as material-ui]))
(ns cljsjs.material-ui-svg-icons
  (:require ["material-ui-icons" :as material-ui-svg-icons]))
The build now completes successfully. I open up the app and see the following errors in the developer console.
failed to load cljs_react_material_ui.reagent.js ReferenceError: MaterialUI is not defined

failed to load cljs_react_material_ui.icons.js ReferenceError: MaterialUISvgIcons is not defined
I add the following symbols
(js/goog.exportSymbol "MaterialUISvgIcons" material-ui-svg-icons)

(js/goog.exportSymbol "MaterialUI" material-ui)
to their respective stubs, The result is that the MaterialUISvgIcons error disappears in the console but the MaterialUI error does not. Which I find confusing.


@gordonk one thing you might try is material-ui/default


Trying to re-use .shadow-cljs compiler cache between CI builds and found that e.g. 1. rm -rf .shadow-cljs && lein shadow compile karma-test ~10-14s compile 2. lein shadow compile karma-test ~1s compile (i.e. the .shadow-cljs dir left as-is from 1.) 3. Tar up and extract the .shadow-cljs dir results in 10-14s compile again!

tar -cz -f cache.tgz -C .shadow-cljs . 
 rm -rf .shadow-cljs
 mkdir .shadow-cljs
 cd .shadow-cljs
 tar zxf ../cache.tgz
 cd ..
 lein shadow compile karma-test
4. lein shadow compile karma-test ~1s compile (i.e. the .shadow-cljs dir left as-is from 3.) What am I missing that is invalidating the cache ? The tar command used is what GitHub Actions cache action uses to cache files. This would speed up e.g. re-frame CI and all our internal builds by about 30%. @thheller


@superstructor everything related to the source files invalidates the cache. so you also need to "cache" your .m2 maven downloads so that they don't change and also your JS deps in node_modules in case you use any


and changing the timestamps of any of your actual source files too of course

Filipe Silva16:12:20

so any git clone busts it

Filipe Silva16:12:10

maybe <> would help?

Filipe Silva16:12:31

the repro above didn't actually use git clone though, I was just overall thinking of how I tried to do the same with GH actions...

Filipe Silva16:12:07

but if git clone will bust the cache for commited source files, and tar will bust the cache for uncommited source files

Filipe Silva16:12:57

then I guess the shadow-cljs cache doesn't do much good in CI?


the timestamps of the cache files themselves don't matter


just having cache for maven based files should already speed things up substantially and that should be easy to do


why these examples launches with shadow-cljs but lacks repl?

Filipe Silva17:12:42

@thheller in the example above, step 3 and 4, it looked like something during the processed of tarring and untarring the shadow-cljs cache busted it


Correct simply tarring the .shadow-cljs cache files dir, deleting it, then untarring it invalidates the cache. No git, .m2 or source file changes. Is that expected ? @thheller


@feikas sorry its not well documented but lein shadow supports any command shown by lein run -m shadow.cljs.devtools.cli --help e.g. lein do clean, shadow cljs-repl client

😲 4

In fact, when I get time I should do a PR to lein-shadow to call shadow.cljs.devtools.cli help directly. At the moment the output of lein shadow --help is not entirely helpful.


@superstructor @filipematossilva maybe don't try to tar the entire .shadow-cljs dir. just do .shadow-cljs/builds


maybe lein shadow does something? haven't checked what that does


if we're using shadow with react native, is there a way to target different platforms - i.e. in js you'd have to have separate file extensions like ios.js , but was hoping maybe we could use reader conditionals like we do for :clj and :cljs


shadow-cljs has support for custom reader conditionals


it does require you to have separate builds per platform, though


wonderful, thanks for the link


anyone able to run expo web with shadow-cljs? I'm following starter template online ( but getting a goog.globalEval not available error when I open browser window. opened up issue there, too:


@alidcastano that issue is fixed in 2.8.81

🙌 4

@thheller upgraded to that version but still seeing same error


need to upgrade the deps.edn, the npm package doesn't matter too much


yea i had upgraded the npm package 😅 thanks