This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-08-01
Channels
- # announcements (1)
- # beginners (71)
- # calva (12)
- # cider (3)
- # clj-kondo (12)
- # cljsrn (9)
- # clojure (167)
- # clojure-dev (21)
- # clojure-europe (5)
- # clojure-italy (60)
- # clojure-nl (6)
- # clojure-spec (6)
- # clojure-uk (60)
- # clojurescript (86)
- # core-async (25)
- # cursive (21)
- # datascript (9)
- # datomic (4)
- # figwheel (8)
- # fulcro (7)
- # graalvm (4)
- # jackdaw (6)
- # jobs (8)
- # juxt (2)
- # leiningen (1)
- # malli (1)
- # off-topic (20)
- # re-frame (31)
- # reagent (5)
- # remote-jobs (3)
- # shadow-cljs (57)
- # sql (6)
- # vim (9)
hi, I'm having trouble connecting cider to shadow-cljs' nrepl. in theory I should be able to cider-connect and then just eval my expressions right there, right? assuming it has to do something to do with this error, but spacemacs says I have the newest version of cider apparently
@shin which cider-nrepl
version do you have in shadow-cljs.edn? or project.clj/deps.edn depending on what you use?
@thheller updated it to the beta mentioned in the error now, still doesn't seem to work though
I know that many people use cider with shadow-cljs so it should work. no clue how current this is but maybe it helps? https://shadow-cljs.github.io/docs/UsersGuide.html#cider
There’s a few: http://descjop.org/, https://github.com/Gonzih/cljs-electron, https://github.com/lucmartens/cljs-electron
I would still give them a try. I think Electron development in Clojure is generally declining though. If I were building a desktop app in Clojure I’d look at cljfx (https://github.com/cljfx/cljfx).
I would try either descjop or lucmartens/cljs-electron and see if they do the job.
@shin hi
the current doc of how to use cider with shadow-cljs is outdated. since there's a built-in support. You can use C-c M-j
launch a cljs repl. cider will ask you to select a repl type. then you just select shadow
, the all things works.
@thheller I want to update the cider section of shadow-cljs document, if there's no maintainer. using cider with shadow is much easier now.
I noticed that my browser closes the shadow-cljs connection after a few seconds at work, could that be part of my problem?
@doglooksgood that'd be nice. docs are here: https://github.com/shadow-cljs/shadow-cljs.github.io/blob/master/docs/editor-integration.adoc
I can load the page and do stuff, it just doesn't update on changes, but maybe the connection never worked: WebSocket connection to '<ws://xxx:9630/ws/worker/app/c0ce03b9-eebd-4c4b-988d-e96f3029881e/dc640c5b-3250-4969-946f-a0e5f9f4a472/browser>' failed: Error in connection establishment: net::ERR_CONNECTION_TIMED_OUT
shadow-cljs by default tries to connect to the same host the original page was loaded from
if you run behind a proxy or on a different host you might need https://shadow-cljs.github.io/docs/UsersGuide.html#_proxy_support
Anyone ?
There’s a few: http://descjop.org/, https://github.com/Gonzih/cljs-electron, https://github.com/lucmartens/cljs-electron
Hi, I found a case where :advanced compilation results in “TypeError: l.C is not a function,” which is similar to what [this link](https://github.com/yogthos/clojure-error-message-catalog/blob/master/cljs/uncaught-typeError-name.call-is-not-a-function.md) describes. In my case, I.C()
is compiled from a javascript interop form (.val snapshot)
. I can provide more details if needed. Is .val
shadowing any cljs.core function like the link suggests? Eventually I got around the issue by calling the .toJSON
method to get around it.
@dawranliou is snapshot
an external JS object?
Yes, it is
that will prevent optimizations from turning the .val
into some single-letter method
I definitely missed the ^js
notation. Thanks.
Is it generally a good idea to put ^js
everywhere I want to call a method on a js object?
Ok let me try everything one at a time. Thanks @lilactown @dnolen!
I’m using shadow-cljs and once I started using {:infer-externs :auto} I saw the warnings. Adding ^js
does solve the problem, so no bugs there. 🙂
our webapp has <script src=cdn/Chart.js>
and uses this in cljs as js/Chart
. However doo with chrome-headless lacks this script when it runs our test so we cannot include test files that require our usage of charts. Does anyone know off hand how to modify the page that chrome headless will eventually load?
solution: :doo {:karma {:config {"customContextFile" "resources/chrome-headless-testrunner.html"}}}
and copying and modifying the custom context file that karma uses: https://github.com/karma-runner/karma/blob/master/static/context.html
@dmateja724 there's also a React Native channel #cljsrn if you don't get a response here
I'm trying to understand how cljs.js/load-analysis-cache!
behaves (or is supposed to behave) in a couple different scenarios. Originally I was using a trick/technique described by (I'm pretty sure) @mfikes . It uses a macro: (defmacro analyzer-state [[_ ns-sym]]
'~(get-in @env/compiler [:cljs.analyzer/namespaces ns-sym]))` and then defines a state var (def state (cljs.js/empty-state))
and then it is used, for example, by (cljs.js/load-analysis-cache! state 'aerial.hanami.core (analyzer-state 'aerial.hanami.core))
That works fine, but can take a fair amount of time in various cases. So, looking around it seemed that if the actual pre-generated cache, in this case the core.cljs.cache.json
file content, is passed to load-analysis-cache!
it would just take the already computed result and use it. But it seems to behave in the same way as using the 'analyzer-state' macro. Am I totally in the weeds on this??
@jsa-aerial What are you trying to understand? (It isn’t clear to me what question you have.)
Take the content of a cache file, feed it to read-string and then pass it to load-analysis-cache!, is it supposed to be used as is to update the compiler state?
When I do this, it seems to recompute the compiler analysis from the name space that's passed and not use the cache content passed
Put another way, it takes as much time passing the precomputed and saved cache content as when giving it the 'analyzer-state' variation
These three variations seem to behave in exactly the same way: The analysis is run from scratch
@jsa-aerial In both cases, data is loaded into an atom. So the question becomes: How fast can you load data into a map? When using a macro to dump a literal map into your generated code, this will have roughly the same perf as if you read Transit-encoded data to obtain that map.
Well, this is more than loading into a map - I mean it takes 20 seconds or so
It certainly seems that way, yes.
It is very strange - you can pass nil
(or indeed, not pass any 3rd arg) and the results are the same
The other thing is - once it is done, things just work as expected. You can eval-str stuff that uses things from the ns, you can define new funcs in the ns and use them, etc. etc
There’s really no magic here. Loading the analysis cache is just that—it is not the same as requiring a namespace and loading JS, etc
Looking at the source for load-analysis-cache! it is indeed a simple swap. But when I run this interactively (at repl via figwheel) it does indeed seem like it is loading the namespace along with all its requires. Maybe this is some odd/toxic interaction with figwheel?
Are you loading the analysis cache for a given namespace, followed by requiring that namespace?
the reverse - namespaces are required and only then are the analysis caches loaded.
If you want to optimize the situation where you require pre-compiled namespaces, then your *load-fn*
implementation can call back with the JavaScript and analysis cache.
If you do that, then cljs.js
calls load-analysis-cache!
with the the analysis cache you supply: https://github.com/clojure/clojurescript/blob/master/src/main/cljs/cljs/js.cljs#L325
Yeah, I was looking into the *load-fn*
usage scenario. When /where should this be bound? I know eval-str opts can take it, but is there a 'global' scenario?
I'm becoming pretty convinced that the weird behavior I see has something to do with some interaction between figwheel, piggyback, and /or cljs-repl
(You can use it as an optimization in certain situations when you know other stuff is already loaded and you just need the analysis cache to additionally be loaded.)
That's exactly what I want - the optimization situation
Looking at the source for load-analysis-cache! it is indeed a simple swap. But when I run this interactively (at repl via figwheel) it does indeed seem like it is loading the namespace along with all its requires. Maybe this is some odd/toxic interaction with figwheel?