Fork me on GitHub
#shadow-cljs
<
2019-11-18
>
grounded_sage14:11:12

I’m trying to pull material-ui into a shadow-cljs project and it fails to load on the browser

thheller14:11:27

looks like they might have migrated to "strict" interop mode? react doesn't have a default export so _react.default doesn't exist

thheller14:11:30

not sure how to handle that yet

grounded_sage15:11:02

Is there a version of materiaul-ui you know that is compatible @thheller?

stefan15:11:58

we are on 4.5.0 with no issues

grounded_sage16:11:26

I still get an error on this for some reason.

stefan16:11:33

how are you requiring the material-ui components?

grounded_sage18:11:09

Requiring like this ["@material-ui/core" :refer [Button]]

grounded_sage18:11:50

"dependencies": {
    ...
    "@material-ui/core": "4.5.0",
  }

stefan16:11:08

Sorry, just saw this response. We are using the default export option, eg ["@material-ui/core/Button" :default button]. I wonder if that would work.

stefan16:11:04

in cases where we want the named export ["@material-ui/styles" :rename {ThemeProvider mui-theme-provider}]

kaosko17:11:06

How do I load npm modules into repl? I should be able to do that right?

kaosko17:11:17

my attempt fails with: (require '["three" :as three]) Execution error (ClassCastException..

thheller17:11:05

@kaosko when reporting errors never ever shorten error messages. need to see the full error to make sense of it. I'm guessing you are in a CLJ REPL but can't say for sure without the full error

kaosko17:11:45

(require '["three" :as three]) Execution error (ClassCastException) at java.lang.String/compareTo (String.java:111). clojure.lang.Symbol cannot be cast to java.lang.String

thheller17:11:23

ok thx. that is indeed a CLJ error so you need to switch to CLJS first

kaosko17:11:48

with (shadow/dev :app)?

thheller17:11:05

(shadow/repl :app)

kaosko17:11:36

ah, that's it thanks! I got the (shadow/dev :app) from https://github.com/thheller/shadow-cljs/wiki/REPL

kaosko17:11:59

The shadow.cljs.devtools.api/dev fn will turn your REPL into a CLJS REPL and auto-compile your project in the background: (shadow/dev :your-build-id)

thheller17:11:20

the wiki is outdated. I'll remove it.

thheller17:11:38

although dev might still work. I'm not sure 😛

kaosko17:11:52

(shadow/dev :app) => :already-watching

thheller17:11:23

yeah, dev is watch+repl combined so it would only work when the watch isn't already running

kaosko17:11:27

yeah figured. shadow/repl was what I was missing

daniel.spaniel18:11:11

is there a hook on shadowjs build where I can put the git sha hash of the current commint into the config section of a file? I want to be able to have the current git sha on the client build so when I push a release to production the server can say "here is the current sha" and the client can check "here is what I have" and can tell the client "your ui version is old, please refresh"

thheller18:11:46

use (ns foo.bar) and (goog-define SHA "some-default-to-compare-against")

thheller18:11:28

then shadow-cljs release --config-merge "{:compiler-options {:closure-defines foo.bar/SHA actual-sha}}"

thheller18:11:04

don't think this is a good idea but it should work

grounded_sage19:11:14

I've now tried ["@material-ui/core/Button" :default Button] and using older versions of material-ui. I'm convinced I'm doing something wrong.

erwinrooijakkers17:11:05

Hi not really an answer perhaps, but we switched to Bulma instead of Material UI. Really happy with that choice. Bulma is CSS only so no need to import any javascript and has similar functionality. Not sure if it works for your case but wanted to let you know!

daniel.spaniel21:11:39

ooo .. thanks @thheller.. will try and let you know how it works. is there better idea ? is there a better way that you can tell the users of an app that their UI is stale ?

tony.kay22:11:43

v70 of shadow-cljs is crashing on me regularly:

14:09:56.270 [XNIO-1 I/O-7] DEBUG io.undertow.websockets.core.request - UT025003: Decoding WebSocket Frame with opCode 1
[2019-11-18 14:09:56.269 - WARNING] :shadow.cljs.devtools.server/cli-checker-shutdown
shutting down ...
14:09:56.273 [shadow-cljs-npm-process-checker] DEBUG io.undertow - stopping undertow server io.undertow.Undertow@39dafaca
14:09:56.278 [shadow-cljs-npm-process-checker] DEBUG io.undertow - stopping undertow server io.undertow.Undertow@3aedac1f
14:09:56.280 [shadow-cljs-npm-process-checker] DEBUG io.undertow - stopping undertow server io.undertow.Undertow@20d61be

tony.kay22:11:47

when running in server mode

tony.kay22:11:05

guess it isn’t so much a crash as some kind of automated shutdown? Annoying as hell, though