This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-04-05
Channels
- # announcements (1)
- # beginners (72)
- # boot (4)
- # calva (35)
- # cider (8)
- # clara (13)
- # cljdoc (31)
- # cljs-dev (34)
- # clojure (64)
- # clojure-europe (1)
- # clojure-finland (3)
- # clojure-italy (23)
- # clojure-losangeles (3)
- # clojure-nl (35)
- # clojure-uk (19)
- # clojurescript (26)
- # cursive (19)
- # datomic (12)
- # duct (5)
- # editors (7)
- # emacs (25)
- # fulcro (40)
- # funcool (5)
- # jobs (2)
- # leiningen (3)
- # luminus (2)
- # lumo (3)
- # off-topic (19)
- # pathom (3)
- # planck (2)
- # reagent (6)
- # remote-jobs (4)
- # rum (1)
- # shadow-cljs (23)
- # spacemacs (6)
- # tools-deps (12)
I inherited a project that has functions like this in dev.clj
:
(defn start []
(shadow.server/start!)
(shadow/watch :app)
(start-app))
(defn stop []
(app/stop)
(shadow.server/stop!))
However, my understanding is that restarting the shadow-cljs server should only be necessary if dependencies change. Is that correct? In other words, it would be better to start the shadow-cljs server via npx shadow-cljs server app
and then just start/stop the shadow-cljs watcher in the start and stop functions?@flowthing yes only changing dependencies should require a restart. stop!
stops all running watch
processes an in turn kills all REPL state/connections
All right, thanks. The way this project is set up is that you're supposed to call lein repl :headless
, then connect to the nREPL with your IDE, and then run (start)
. This way (stop)
doesn't kill the REPL.
Right. I guess the choice between starting the shadow-cljs server from the command line or using the embedded server here is mostly a matter of preference, then?
yeah. I think things are more reliable if you leave shadow-cljs running independently but otherwise things work the same
Is it possible to switch between connected clients from the cljs
repl? Couldn’t find anything in the docs.
@grav not currently no. the web ui at http://localhost:9630 lets you select which client you connect to but that API isn't accesible elsewhere currently
That’s good enough for me - it allows me to delete the caches on the various clients when I mess up 🙂
Btw, I eventually got both iOS and Android to connect to both https and ssl with live-reload and everything. I just needed to explicitly tell iOS to trust my custom root cert, and I needed to setup port forwarding via Chrome DevTools for both https and wss and use localhost
from Android.
Being able to inspect both devices directly from IntelliJ would be freakin’ awesome, but at least the repls in Shadow CLJS’ web-ui brings me some of the way 🙂
Hello, i'm trying to use shadow-cljs for writing a ClojureScript script on Node.js I get an error
No such namespace: js
The instructions that got me there:
0. Configure shadow-deps.clj
:
{:source-paths ["src"]
:dependencies []
:nrepl {:port 3333}
:builds
{:app {:target :node-script
:main demo.script/main
:output-to "out/demo-script/script.js"
:output-dir "public/js"
:asset-path "/js"
:modules
{:main
{:entries [demo.script]}}}}}
1. shadow-cljs node-repl app
:
cli version: 2.8.26 node: v10.9.0
shadow-cljs - server version: 2.8.26 running at
shadow-cljs - nREPL server started on port 3333
[0:0]~cljs.user=>
2. Connect to the Remote Configuration nREPL port 3333 in Cursive, open REPL and see this message:
Connecting to remote nREPL server...
Clojure 1.10.0
3. Evaluate (shadow/repl :app)
in the REPL
(shadow/repl :app)
To quit, type: :cljs/quit
=> [:selected :app]
4. Evaluate (js/console.log "working?")
5. Receive the error
Any idea how to solve this?I figured something out on this link [shadow-cljs guide by loganpowell](https://github.com/loganpowell/shadow-proto-starter#using-protorepl): > For Node development - unlike when targeting the browser - you'll use:
(shadow.cljs.devtools.api/node-repl)
After evaluating that expression I don't get the error anymore, so I guess the instruction #3 should be replaced with this, in the instruction list I've described above.