shadow-cljs

https://github.com/thheller/shadow-cljs | https://github.com/sponsors/thheller | https://www.patreon.com/thheller
2021-05-03T07:46:15.178400Z

@thheller I was thinking a bit more about the approach in https://github.com/thheller/reagent-react-native with react-native/metro separated into a subdirectory. You specifically said "CLJS tooling related things" go in the top-level package.json. Is it accurate that that conflicts a bit with the default behaviour {:npm-deps {:install true}} which installs non-tooling JS deps in the top-level package.json / node_modules, instead of the one in react-native/, where metro in the end looks for it? One might end up with different versions of the same package in the two node_modules directories.

thheller 2021-05-03T08:12:17.179100Z

that is correct yes. I'll likely remove the automatic :npm-deps install completely at some point and make it a proper manual command instead

💯 1
thheller 2021-05-03T08:13:18.180Z

but the duplicate install won't be used under normal circumstances so it doesn't matter too much for now

thheller 2021-05-03T08:14:23.180900Z

also you don't have to do this separation. it just made sense to me. I also don't actually use react-native for anything so I might be totally wrong

2021-05-03T11:12:54.183300Z

I like the separation very much, I was delighted when I found that example! There's so many files in a react-native project, all on the top level, that just come straight from the react native template. I like a cleaner workspace. Thanks! Then I'll set {:npm-deps {:install false}} and go with that one right away. I briefly tried debugging though and it didn't find the CLJS source. I suspect that that has to do with the fact that the CLJS source files are outside of the metro / react native root, but I didn't have time yet to look into that.

thheller 2021-05-03T11:25:31.183800Z

who didn't find cljs sources? metro shouldn't care, it should only see the sources generated in that dir https://github.com/thheller/reagent-react-native/blob/master/shadow-cljs.edn#L14

2021-05-03T11:54:01.184300Z

I mean the original CLJS for source-mapping during debugging

2021-05-03T11:54:33.184800Z

But as I said, I just stumbled over this and haven't had a moment to confirm or disprove that shallow hypothesis

thheller 2021-05-03T11:57:42.185100Z

does react-native finally support source maps? been a while since I checked

thheller 2021-05-03T11:57:58.185400Z

source maps otherwise are self contained and contain all sources

Fabim 2021-05-03T13:49:13.191200Z

My app is surprisingly large in release mode. I used shadow-cljs release app on my reagent/reframe app. the js folder that is created is 25MB. do I need to manually delete the cljs-runtime folder?

2021-05-03T14:22:36.192300Z

@merklefabian try deleting the output folder before doing release app. Most of the big stuff in there is only needed for the development build.

thheller 2021-05-03T14:23:35.192600Z

the cljs-runtime folder is not used by release builds yes

Fabim 2021-05-03T15:08:38.192700Z

Thanks for your quick answer. Whats the reason it is not deleted automatically?

thheller 2021-05-03T15:12:23.192900Z

shadow-cljs doesn't delete stuff as sort of a rule 😛

2021-05-03T17:24:28.194600Z

is it still possible to 'hack' on shadow-cljs by adding the lib to the classpath? i've added it to src/ and i get conflicts on compile so i assume it is being added to the cp. unfortunately i don't see changes i've made to the codebase, or see any hot reloads when i change cljs files

thheller 2021-05-03T17:29:10.195600Z

@biscuitpants I'm not sure I understand the question. what did you add to src? replacing shadow-cljs internal namespace should be fine yes?

thheller 2021-05-03T17:29:40.196200Z

if you are using shadow-cljs.edn only (no deps.edn, project.clj) you might need to add :aot false to the top level

2021-05-03T17:35:25.197700Z

yeah i've got src/shadow/cljs/ui/components/inspect.cljs and just added a simple prn to ui-tap-panel and it doesn't seem to be overwriting the default inpsect.cljs

2021-05-03T17:35:38.198100Z

i'm using shadow-cljs.edn with deps.edn and :deps true

thheller 2021-05-03T17:36:53.198400Z

you can't hack the cljs parts that way

thheller 2021-05-03T17:37:19.198900Z

those are precompiled and only the finished JS files is used

2021-05-03T17:37:38.199100Z

ahhh

2021-05-03T17:37:44.199300Z

well that explains it 😄

2021-05-03T17:40:01.199500Z

thanks for the help 🙂

thheller 2021-05-03T17:41:03.199900Z

you can compile the UI code locally and replace it for your app if you want

2021-05-03T17:41:12.200100Z

yeah that is what i'm going to do

2021-05-03T17:41:34.200700Z

fwiw i'm trying to add js/Object support to inspect

thheller 2021-05-03T17:41:50.201Z

that is already supported?

2021-05-03T17:42:25.201800Z

hmm i'll double check my versions, but doing tap> on a pure JS object just printed js/Object

thheller 2021-05-03T17:42:33.202Z

for that you don't need to change the UI code at all btw

thheller 2021-05-03T17:42:50.202300Z

since that part is handled by the code that is injected into your app

2021-05-03T17:43:17.202600Z

ah. i'll dig more through the code then. definitely missed something

2021-05-03T17:44:08.203200Z

thank you

thheller 2021-05-03T17:44:37.204Z

that would be the support for generic JS objects

thheller 2021-05-03T17:45:09.204600Z

you can extend the Datafiable protocol onto any objects in your codebase and it'll just work in the UI

2021-05-03T17:46:03.205100Z

ahhh that is much easier! i did not know that. thank you

2021-05-03T17:46:06.205300Z

really nice way to do that

thheller 2021-05-03T17:50:50.206200Z

can be handy to be able to look into "foreign" objects via the UI

2021-05-03T17:51:40.206800Z

ahh that's awesome. very useful for custom objects

2021-05-03T17:52:03.207100Z

really useful for react/other components

Ryan Jerue 2021-05-03T17:56:08.208700Z

Hello @thheller looking at this guy https://github.com/thheller/shadow-cljs/issues/434#issuecomment-461206429 It looks like that this means that

:js-options
{:source-map false}
would prevent source maps from things inside of node_modules from being outputted?

thheller 2021-05-03T17:58:21.209400Z

no, there is no separate setting for node_modules source maps

thheller 2021-05-03T18:21:49.210300Z

hmm kinda accidental that this works then I guess

zhuxun2 2021-05-03T23:08:02.214900Z

Is there an easy way to "re-export" a variable from a js libary using the same name? For example, instead of having to say:

(ns xxx
   (:require ["my-lib/my-thing-1" :default my-thing-1*]))

(def my-thing-1 my-thing-1*)
for every my-thing-n, is there a way similar to (:require ["my-lib/my-thing-1" :default my-thing-1* :reexport), so that I can use xxx/my-thing-1 in another ns in the same project?