@thheller Would it be possible to compile an advanced build of reagent and let people provide React using a script tag, so the version of React becomes a choice in the HTML?
or are the names of the React library also mangled by Closure?
https://shadow-cljs.github.io/docs/UsersGuide.html#js-resolve-global
w000t!
thanks
npm packages in general don't go through advanced so renaming is generally not an issue (if you have externs of course)
@thheller is this :js-resolve
option something from shadow or cljs?
For completeness, I had to configure it like this:
:js-options
{:resolve {"react" {:target :global
:global "React"}
"react-dom" {:target :global
:global "ReactDOM"}}}
You might want to update the example in the bookbut it seems to work perfectly, thanks!
what do I need to update? isn't that the example in the book? :resolve
is purely from shadow, CLJS handles this differently via :foreign-libs
@thheller "react-dom"
. When I left that out, my website got stuck in an infinite loop (since there were still some node modules in the project, things got weird)
hmm, the dev build worked fine with React from a CDN, but still got some problems when compiling with
EDIT: probably some other dev build running in the background, messing things up.release
. Somehow it also re-creates a package.json, etc, while, I think it shouldn't have to?
Hi, I am new in clojurescript world. I was trying to do breakpoint debugging in VSCode with Calva. But could not able to do that. I followed this doc: https://calva.io/debugger/#:~:text=You%20can%20insert%20a%20breakpoint,level%20form%20with%20alt%2Benter%20. Is there any Video instructions available for it?
At the very top of that page: > The debugger currently does not support ClojureScript And there's also the #calva channel here.
is there some simple cljs http library for node? (preferably one that just blocks for me so i don't have to play around with go chans etc)
blocking in node? lol, good luck with that :)
Await does not block for you 馃槷
It's just a syntax sugar for Promises. If you looking for such sugar then check Promesa out.
promesa isn't much different from just calling .then and .catch though (in cljs world)
Do you thing that async/await is in some sort different?
no i'm well aware that it's syntax sugar and i was hoping for something similar
<p! is nice but you must use it in a go block which makes passing things around much more difficult
I'm trying to avoid channels on Clojurescript as much as I can now. It makes the bundle size really huge even for simple operations. Actually promesa is something you seek for: https://cljdoc.org/d/funcool/promesa/6.0.1/api/promesa.core#plet
oh wei that plet really looks amazing. reminds me of manifold's let-flow. thanks, i'll check that out!
It鈥檚 really got soft. To full async/await alike flow only try/catch as a macro would be needed. Plet it's even better than pure async/await and with bluebird you can get a really good performance!
okay then just "anything that doesn't want me to juggle around async chans"
cljs-ajax is what is used a lot, I've also used it in several projects
not sure if it works with node or only in browser
in other cases I would just write raw interop with the node stuff
It's possible when using fibers 馃槃
(defn <!!
[c]
(let [f js/Fiber.current]
(go
(.run f (<! c)))
(.yield js/Fiber)))
But it's Node.js only and it works terribly bad with channels
If I have a map like (ns quux) (def namespaces {'foo foo/bar})
in my code, is my assumption correct that the map will only contain a reference to the function foo/bar
and Closure will not actually duplicate a copy of that function to the quux
namespace?
I wonder about this since in this report https://borkdude.github.io/scittle/report.html you see that it pulls in about 300kb from cljs.core but also has about 300kb in sci.impl.namespaces
, which is a bit suspicious imo, since sci.impl.namespaces
should mostly contain references to other functions.
you are creating huge amounts of vars with metadata, the actual code probably is only a fraction of that. yes, the maps will only contain references, it won't duplicate the code.
true, I should investigate if I can elide this stuff, perhaps using some goog defines
yup sadly that lib doesn't work on node
time to write some Nice Interop
httpurr is really nice: https://funcool.github.io/httpurr/latest/ https://github.com/funcool/httpurr/blob/master/src/httpurr/client/node.cljs
thanks!
thheller: yep, that was it
i was hoping for something along the ease of js await