Fork me on GitHub
#shadow-cljs
<
2020-07-07
>
steveb8n01:07:28

Q: anyone know how to build shadow-based devcards for a prod release? I’m trying to make it work here https://github.com/stevebuik/fork-malli-ideas

thheller07:07:52

@steveb8n you are only setting :devcards true for dev. move that "up". also don't set :optimizations :none is never has any effect anywhere is already the forced default for dev

steveb8n07:07:21

ah ok. I’ll try that immediately. thanks!

thheller08:07:02

@benny I'd expect so. I've never done an actual released RN app

steveb8n08:07:50

@thheller that worked (but you already knew that 🙂. much appreciated

romdoq09:07:24

How can I debug hot reloading? For some reason, this week it's stopped working for me. 😞 The rebuild is triggered, I see the Shadow spinner in the browser, but the page doesn't get updated. 😕 I have an :npm-module which is used by a larger webpack'ed application. AFAIK the only thing that's changed since last week is that I updated a bunch of packages on my machine (Debian Testing), mostly libraries. I tried downgrading Chromium, to no avail.

thheller10:07:35

@mel.collins what does the console say? is you after-load hook getting called? if so you must debug your app not shadow-cljs

romdoq10:07:47

Hmm, doesn't look like after-load is being called, no 😕

romdoq10:07:31

I did a long-overdue upgrade of shadow-cljs not long ago, and if I revert to the previous version (2.8.something) it works again, so maybe I missed an important change? (though I'm not sure why it would've taken a week to manifest)

thheller11:07:18

maybe the usual version conflict? make sure you have no conflicts if you use project.clj/deps.edn

romdoq11:07:15

I do use deps.edn, but the shadow-cljs version does match between that and package.json.

romdoq11:07:16

core.async was at a very different version to shadow's deps, but updating it didn't fix the issue

thheller11:07:26

bad core.async versions are known to cause issues

thheller11:07:32

and so are all the other possible conflicts

romdoq11:07:49

Hmm, downgrading clojurescript from .773 to .597 (as in shadow-cljs/deps.edn) causes errors with cider/piggyback.clj. Am I looking at the right file there?

romdoq11:07:59

Ah, clojars. I had a feeling there was somewhere else that I found the dep versions previously

romdoq11:07:29

Hm. I had to add closure-compiled-unshaded, but I now have all four of the "important" dependencies specified at the same versions in my deps as on clojars, but still no dice 😕

romdoq12:07:38

Bah. I just tried using shadow-cljs.edn for dependencies (without shadow's own deps) and hot reloading still doesn't work 😞

thheller12:07:42

what is exactly IS happening though? I mean you said something happens?

thheller12:07:55

what does shadow-cljs watch app give you?

thheller12:07:59

what does the browser console say? any warnings/errors?

romdoq12:07:27

The only thing from Shadow in the browser console is: "shadow-cljs: #3 ready!" The things my before-load and after-load should both print to the console don't appear.

thheller12:07:58

that just means that the connect happens

thheller12:07:04

what happens if you make a change?

thheller12:07:19

in the watch and in the browser console?

romdoq12:07:25

in the watch I get the usual:

[:npm] Compiling ...
[:npm] Build completed. (321 files, 2 compiled, 0 warnings, 0.44s)
In the browser, I get nothing from shadow. Just webpack doing its normal:
[HMR] bundle rebuilding
...
Ignored an update to declined module ../path/to/my/yarn/linked/cljs/module.js

romdoq12:07:43

I do get the Shadow spinny thing in the corner of the browser though

romdoq12:07:16

FWW, on startup, the watch warns about: Nashorn engine, a too-new react version, and an illegal reflective access by mranderson048; but none of those are new

thheller12:07:59

wait you have webpack HMR active?

thheller12:07:32

and this is a :npm-module build?

romdoq12:07:23

webpack's reloading is declined in the module which imports the cljs module, which has worked previously

thheller12:07:08

sorry can't help you with this. too many unknowns. if you make a reproducible example I can take a look but running webpack HMR together with watch seems like a recipe for disaster

romdoq13:07:49

Yeah, thanks for the help anyway. 🙂 The setup has worked well so far, but it looks like some change in Shadow (since 2.8.55!) broke it. I'll go back and try to find the version/change where it stopped working, and debug from there.

romdoq13:07:30

Not how I intended to spend my last workday before holiday, but these things happen 😄

romdoq14:07:57

@thheller Looks like the cause was this part in build/targets/npm_module.clj:

(cond->
        ...
        (and (= :dev mode) (:worker-info state))
        (update config :devtools merge {:autoload false ;; doesn't work yet, use built-in for now
                                        :use-document-host false}))
Before this was changed (in 2.8.56), autoload was mis-spelled, so didn't actually get disabled: https://github.com/thheller/shadow-cljs/commit/c75fa3376efdbc8405e5f978db1db5f748861c55 However, when autoload is not false'd here, hot reloading works in my environment, so I'm not sure what the comment is referring to as not working?

thheller14:07:54

just set :devtools {:autoload true} then?

romdoq14:07:13

That code in npm-module seems to override whatever is specified in shadow-cljs.edn

romdoq15:07:53

However, if I patch npm_module.clj renaming :autoload to :autoload* in the aforementioned code, hot reloading works without any setting in the edn file.