shadow-cljs

https://github.com/thheller/shadow-cljs | https://github.com/sponsors/thheller | https://www.patreon.com/thheller
Stefan 2020-12-31T08:50:38.225600Z

Hi there! I’ve picked up a side project and started using awesome ShadowCLJS again. I’m trying to figure out something but I’m having a hard time. I’m hoping someone here can give some advice. I’m building a :browser target for use in an iOS / Android web view. On iOS I have it working. On Android there’s the issue however that Android has 10.0.2.2 as IP address of the host running the development environment, not localhost. So what I’m observing is that the initial load of my compiles JS bundle is working (because I load it from 10.0.2.2, but then ShadowCLJS tries to connect to localhost. I’ve tried setting :devtools-url` to <http://10.0.2.2:8080>, but then the websockets upgrade doesn’t work (“error during websocket handshake: unexpected response code: 200”). I have the feeling that it should be possible somehow, but how…? Thanks for any help / pointers!

Stefan 2020-12-31T09:32:33.227600Z

While ruminating this over breakfast, I realized that I already knew the solution, just didn’t think of it at the right time. Like the manual says, :devtools-url should point to the primary server. So it should have been <http://10.0.2.2:9630> . After changing that it worked. 🎉

👍 1
Alexis Vincent 2020-12-31T13:43:02.228400Z

@thheller Thanks, useful to see. I’ll play around with :esm and see what I can get going.

Alexis Vincent 2020-12-31T13:43:42.229200Z

What is supported by :browser but not by :esm ?

Alexis Vincent 2020-12-31T13:45:31.230200Z

What are the 2 PR’s going to allow for? Will they enable mograting away from goog.provide ?

thheller 2020-12-31T14:15:54.231200Z

the output will look like :esm currently but a little cleaner I guess. goog.provide is never part of an optimized build so I'm not sure what you mean. CLJS will continue to use that for a while.

ghaskins 2020-12-31T14:50:02.232100Z

@thheller is there a way to access the lein project name/version programmatically from within the app?

ghaskins 2020-12-31T14:50:16.232500Z

for instance, in jvm clojure, I can do (System/getProperty "attribute-service.version")`

ghaskins 2020-12-31T14:50:27.232800Z

is there a parallel in cljs you are aware of?

thheller 2020-12-31T15:18:36.233Z

a macro I guess

Alexis Vincent 2020-12-31T15:29:14.233600Z

Is there any reason I should use browser over esm for browser target?

thheller 2020-12-31T17:08:15.234300Z

esm is experimental and unfinished. browser is stable and used by many.

thheller 2020-12-31T17:08:23.234600Z

you don't gain much by using esm imho