This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-05-05
Channels
- # aleph (10)
- # announcements (2)
- # babashka (83)
- # beginners (41)
- # biff (2)
- # calva (6)
- # cider (7)
- # clerk (3)
- # clj-kondo (7)
- # clojure (89)
- # clojure-berlin (1)
- # clojure-brasil (4)
- # clojure-dev (15)
- # clojure-europe (16)
- # clojure-nl (1)
- # clojure-norway (54)
- # clojure-spec (1)
- # clojure-uk (4)
- # clojurescript (2)
- # conjure (3)
- # datomic (7)
- # emacs (4)
- # events (1)
- # figwheel-main (1)
- # graalvm (5)
- # gratitude (2)
- # honeysql (14)
- # hyperfiddle (86)
- # introduce-yourself (1)
- # joyride (9)
- # lsp (179)
- # malli (29)
- # music (1)
- # nyc (14)
- # off-topic (6)
- # polylith (16)
- # rdf (8)
- # releases (2)
- # rum (1)
- # shadow-cljs (26)
- # specter (2)
- # sql (4)
- # uncomplicate (2)
- # xtdb (16)
Hi all, my current project has shadow-cljs for frontend and lein for the backend. This creates problems in CIDER, where I cannot be connected to both instances. I would like to use cider-connect-clj&cljs, and it seems I need both to be the same build tool (lein or shadow-cljs). How would I accomplish this? I currently have a project.clj and shadow-cljs.edn. Do I need to change shadow-cljs.edn to use lein, or somehow convert project.clj into shadow-cljs?
I'm pretty sure cider can connect to two instances, so you can leave everything as is. you can move dependencies from shadow-cljs.edn to project.clj to launch via lein https://shadow-cljs.github.io/docs/UsersGuide.html#Leiningen
It seems cider gets confused about the two instances (two different ports). I moved the dependencies like in the manual, but I am getting "Clojurescript is not available" when running cider-connect-sibling-cljs. Here is shadow-cljs.edn:
{:lein {:profile "+cljs"}
:nrepl {:port 8777}
:jvm-opts ["-Xmx1G"]
:dev-http
{8280 "resources/public"
8290 "target/browser-test"}
:builds
{:app
{:target :browser
:output-dir "resources/public/js/compiled"
:asset-path "/js/compiled"
:modules
{:app {:init-fn re-frame-proj.core/init}}
:devtools
{:preloads [
;; devtools.preload
;; re-frisk.preload
]}
:dev
{:compiler-options
{:closure-defines
{ }}}}}}
and project.clj:
(defproject re-frame-proj "0.1.0-SNAPSHOT"
:description "Backend server for Slix using Clojure."
:url ""
:license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
:url " "}
:dependencies [[org.clojure/clojure "1.11.1"]
[ring/ring-core "1.8.2"]
[ring/ring-jetty-adapter "1.8.2"]
[cider/cider-nrepl "0.28.4"]
[org.clojure/tools.namespace "1.3.0"] ; used for lispy
;; [org.clojure/java.jdbc "0.7.12"]
;; [org.xerial/sqlite-jdbc "3.40.1.0"]
[compojure "1.7.0"]
;; [com.github.seancorfield/honeysql "2.4.972"]
[ring-cors "0.1.13"]
[ring/ring-json "0.5.1"]
[org.clojure/data.json "2.4.0"]
[io.aviso/pretty "1.3"]
;; for memory measurement
[com.clojure-goes-fast/clj-memory-meter "0.2.1"]
;; [datascript "1.4.0"]
;; [io.replikativ/datahike "0.6.1531"]
[dev.weavejester/medley "1.6.0"]
[clj-time "0.15.2"]
[datalevin "0.8.5"]
;; [org.clojars.quoll/asami "2.2.4"]
]
:main re-frame-proj.core
;; for memory measurement
:jvm-opts ["-Djdk.attach.allowAttachSelf" "-Xmx8G"]
:repl-options {:init-ns re-frame-proj.core}
:profiles
{:cljs
{:source-paths ["src"]
:dependencies
[[thheller/shadow-cljs "2.23.3"]
[reagent "1.1.1"]
[re-frame "1.3.0"]
[binaryage/devtools "1.0.7"]
[re-frisk "1.6.0"]
[cider/cider-nrepl "0.28.4"]
[cljs-http "0.1.46"]
[cljs-ajax "0.8.4"]
[day8.re-frame/http-fx "0.2.4"]
[clj-commons/secretary "1.2.4"]
[com.cemerick/url "0.1.1"]
[venantius/accountant "0.2.5"]
[com.rpl/specter "1.1.4"]
[philoskim/debux "0.8.3"]
[expound "0.9.0"]
[re-com "2.13.2"]]}}
)
sorry, can't answer cider questions. I don't have the slightest clue how it works. I'd assume the cider docs cover everything.
I’ve used CIDER with Leiningen and Shadow CLJS before, but too much information is omitted in the project.clj
for me to tell what is possible going wrong
e.g. where is the nrepl middleware? are you using the proper version of cljs and google-closure for your version of shadow-cljs?
@hifumi123 I have edited the file so that it's in full. It seems I am missing some dependencies on lein side that is necessary for cljs?
if thats using the lein nrepl server (not the shadow-cljs one) you need to add :nrepl-middleware
https://shadow-cljs.github.io/docs/UsersGuide.html#_embedded_nrepl_server
IIRC you also need to provide your own CLJS dependency and ensure it is compatible with shadow-cljs version youre using
not necessarily. shadow-cljs also brings it in. only need to be explicit if you have conflicts, ie. another dependency bringing in an older incompatible version
Ah, I see. For good measure I always used :managed-dependencies
so that org.clojure/clojurescript
was pinned to the exact version shadow-cljs
would depend on.
I got it to work. Thanks for the help! I haven't delved into leiningen before, so I had some trouble with profiles.
Is there shadow-cljs.edn
config equivalent to that shown https://clojure.org/guides/deps_and_cli#socket_repl? I have shadow-cljs
running in server mode on a remote host. I tried connecting with netcat
but that seems to time out (though I guess I'm missing configuration I probably need).
No nrepl works I'm just curious if there's some extra steps I need to take bc the connection is refused or else it times out. But that might be beyond the scope of anything shadow can deal with I suppose
I have server running but when I connect through calva and put in the IP address port combo it does not work
are you aware how insecure it is to have an "open" repl server? is this all running in a trusted network or the open internet?
Not specifically but certainly sounds like a bad idea. But yeah this is private domain at work
you have several options, I recommend keeping nrepl on localhost and using a ssh reverse tunnel
Good to know. I'll check that out. Thanks for the advice.