This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-12-09
Channels
- # adventofcode (95)
- # announcements (22)
- # aws (2)
- # babashka (14)
- # beginners (133)
- # bristol-clojurians (2)
- # calva (43)
- # cider (11)
- # clj-kondo (82)
- # cljsrn (20)
- # clojure (100)
- # clojure-europe (12)
- # clojure-italy (9)
- # clojure-nl (7)
- # clojure-poland (1)
- # clojure-spec (4)
- # clojure-uk (105)
- # clojurescript (42)
- # cryogen (1)
- # cursive (6)
- # data-science (1)
- # datomic (5)
- # euroclojure (2)
- # figwheel (4)
- # fulcro (4)
- # garden (1)
- # graphql (3)
- # hoplon (4)
- # jobs (1)
- # joker (3)
- # luminus (4)
- # malli (15)
- # off-topic (129)
- # pathom (10)
- # re-frame (43)
- # reagent (7)
- # reitit (3)
- # shadow-cljs (31)
- # vim (6)
- # yada (39)
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]))
and
(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 see https://shadow-cljs.github.io/docs/UsersGuide.html#_about_default_exports
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
so any git clone busts it
maybe <https://stackoverflow.com/a/55609950/2116927> would help?
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...
but if git clone will bust the cache for commited source files, and tar will bust the cache for uncommited source files
then I guess the shadow-cljs cache doesn't do much good in CI?
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? https://github.com/day8/re-frame/blob/master/docs/CodeWalkthrough.md
@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
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
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
anyone able to run expo web with shadow-cljs?
I'm following starter template online (https://github.com/PEZ/rn-rf-shadow) but getting a goog.globalEval not available
error when I open browser window.
opened up issue there, too: https://github.com/PEZ/rn-rf-shadow/issues/11
did you upgrade the npm package or this https://github.com/PEZ/rn-rf-shadow/blob/master/deps.edn#L7?