This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-05-04
Channels
- # announcements (2)
- # beginners (30)
- # calva (30)
- # cider (10)
- # cljs-dev (4)
- # clojure (59)
- # clojure-nl (2)
- # clojurescript (21)
- # cursive (22)
- # datascript (3)
- # datomic (5)
- # duct (5)
- # figwheel-main (1)
- # flambo (2)
- # fulcro (8)
- # jackdaw (1)
- # joker (9)
- # off-topic (24)
- # pathom (1)
- # re-frame (2)
- # rewrite-clj (4)
- # shadow-cljs (163)
- # sql (14)
- # tools-deps (6)
- # vim (24)
- # yada (3)
Can shadow-cljs support a module like this in a react-native
target? https://github.com/IgorBelyayev/React-Native-Local-Resource
not sure I understand what that does but looks like a native module so shadow-cljs has nothing to do with that
> Don’t include 5mb of text this way, load it at runtime instead. I guess that rules my use case out, the compiled JS code that I want to load is already 4.5mb and I hardly have any code of my own yet 😉
(In this case the file that I’ll be reading is the output of another shadow-cljs target 🙂 )
Still plodding along 🙂 I’m going to write a blog post about this when I’m done, titled something like “the 42 things I learned this holiday about react native, webviews, web audio in react native, and doing all that using clojurescript” 🙂
Hey folks – I'm trying to get browser hot loading and the browser REPL working when shadow is running behind a secure HTTPS -> HTTP proxy (nginx w/proxy_pass). My app loads over https://
but tries to connect the primary server's websocket using ws://
, which causes a mixed content error. Is there a way to get a wss://
scheme without telling shadow to handle the SSL itself (because it's already behind a secure proxy)?
@alexander_clojurians https://shadow-cljs.github.io/docs/UsersGuide.html#_proxy_support
@thheller on the proxy support stuff (I'm working with Alexander) — with the :devtools-url
parameter we can get things to work but it's a little impractical in the context of every developer having their own URL and reading this configuration from the environment before starting shadow-cljs.
We were wondering if it might make sense to default to wss://
if the devtools are loaded on a page that already uses https://
? This would cover our use case without additional configuration and might be a reasonable default? Could be this breaks something else of course but just wanted to give a bit more context on the situation.
right, in this case shadow doesn't have access to the cert because it sits behind a proxy that shadow doesn't know about
I see how the https -> wss default could break things though so I guess we'll configure things using the devtools url option
If you can think of something that would work for your case I can take a look at implementing it
We run shadow locally behind something custom (similar to ngrok) that forwards shadow's ports. The idea is that you can access that on other devices or that coworkers can access it from anywhere.
The server is nginx with custom certs set up. Shadow does not know about these certs. This is intentional since we still want to be able to access things via localhost. In the case of a request going through nginx https://
is used but with out the devtools-url
Shadow will try to use ws://
which causes "insecure content" errors.
Does this clarify things a bit more?
I'm not sure I understand the hosts
suggestion. Not 100% if relevant but we'd have an instance of this application for every coworker, each with a different public URL
> if it connects to
that'll fail if shadow-cljs has no ssl configured
I think my thinking here is: if shadow is loaded on an https://
page — wouldn't it make sense to assume the websocket connection should also use wss://
. In fact in most browsers it just won't work otherwise due to insecure content restrictions, I think?
the issue is that shadow-cljs connects to itself DIRECTLY. it does not go through your nginx
ahh, so it doesn't use whatever is in the URL bar and will always use localhost
?
Is that what you're saying? That might be where my confusion is coming from 😅
right, we expose that server port as shadow expects it
right — so if it takes the hostname, it could also take the protocol?
(sorry if I'm asking naive questions, just trying to wrap my head around this)
sorry 🙂
it cannot take the protocol because it cannot connect to
since that has no ssl configured
right, but in our case it has 😄
because we proxy stuff through to shadow
I'm confused now ... I was assuming your proxy is serving the normal document. so
or whatever that is, ie. port 443
yes, it's doing that but it's also proxying 9630 otherwise the document served under https:// couldn't connect to that port
sorry, I'll come back in a minute with better details
thanks for all your help and sorry this is a bit confusing 😄
yes. in practice both ports forward to a port on localhost and those ports are ssh forwarded to a local machine
no, foo
and bar
might be shadow-cljs builds on two different machines (i.e. people's computers)
ah, yes
what we'd have to do with how things work now is have a different devtools-url
for each machine (arguably could be much worse)
sounds like we're approaching shared understanding 🎉
yeah, that's kind of what we were thinking of but it should only force SSL if the document is loaded via https
because for local dev we will still mostly want to use basic localhost stuff
right, I guess we'd need to customize the (when ssl ,,,)
somehow so that it also takes the document's protocol into account
you mean set ssl via goog-define?
awesome! no urgency to this to feel free to sit on it for a bit 🙂
Good night & thanks again 🙌
@thheller I’ve been following this channel for a while now. Would it be an idea to add a troubleshooting / FAQ section to your user manual?
Don’t get me wrong, I think the manual is very good. It’s really complete and has a lot of detail. I feel that it can be even better somehow, I’m just not sure exactly how. Maybe it’s because I’m a beginner in CLJ(S).
It can most definitely be better .. just takes a large amount of time and I also suck at writing
I think for me it’s maybe about the “information density” of the document. I’ll give it a thought.
Oh by the way the fact that it’s a one page document is awesome, it makes it very easy to search for things.
I was thinking the other day about having a search bar at the top and maybe some additional organization / tagging to enable searchability
typically what I do is open up the user guide, Ctrl-F what I’m looking for, if I don’t find it I come ask here 😛
Yeah me too, but indeed sometimes it is hard to know what exactly you’re looking for, especially as a beginner.
for example a library is calling require
to throw an error but shadow insists the lib must be installed
without :keep-native-requires
it works like the browser which wouldn't have access to node built-ins so they need to be bundled too
you can just use the normal shadow-cljs stuff without :js-provider :shadow
and post process the file with something like https://github.com/zeit/ncc
@thheller I think I just managed to load the code generated by my :browser target into a React Native Webview. I just injected the code, I’m not yet calling it. Would you expect that it is running a repl client (or what is the term)? Should I be able to connect to it, and if yes: how?
and you probably need to configure :devtools-url
since the default browser logic won't work https://shadow-cljs.github.io/docs/UsersGuide.html#_proxy_support
The webview should be the whole thing, the same thing that is powering Chrome/Safari, so websockets etc should be available
Yeah well that’s not easy. I think I’ll have to use reactortron or something for that.
Oh my it’s even easier than I imagined 🙂 🙂 🙂 It’s running a repl allright and I can simply use shadow-cljs cljs-repl
to connect. Hurray! 🎉
Hello
A JS library I am trying to use (in the browser) is throwing with Uncaught TypeError: process.nextTick is not a function
.
I know next to nothing about JS/node/etc, so I might be wrong, but from what I gather, process
is a node global that exposes that function, and shadow does mock part of that global which it then passes to the library when it's required: https://github.com/thheller/shadow-cljs/blob/master/src/main/shadow/js.js#L55
It does, however not mock or polyfill nextTick
.
So my question is: Can I monkey-patch shadow.js.process
? How?
Or can I somehow replace the whole process thing with a polyfill from webpack/browserify or similar? (I think the library is designed to run with webpack)
you can just monkey patch it in your code via (gobj/set shadow.js/process "nextTick" js/goog.async.nextTick)
or so
don't forgot to require goog.async.nextTick
and shadow.js
in the namespace that does that