This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-08-02
Channels
- # announcements (3)
- # aws (2)
- # babashka (60)
- # beginners (21)
- # cljs-dev (35)
- # cljsrn (3)
- # clojure (53)
- # clojure-android (2)
- # clojure-australia (3)
- # clojure-europe (45)
- # clojure-france (4)
- # clojure-nl (4)
- # clojure-uk (6)
- # clojurescript (33)
- # core-typed (1)
- # cursive (13)
- # datomic (6)
- # duct (1)
- # emacs (2)
- # fulcro (10)
- # introduce-yourself (3)
- # jobs (2)
- # jobs-discuss (13)
- # leiningen (1)
- # malli (19)
- # missionary (63)
- # music (1)
- # off-topic (21)
- # pathom (3)
- # polylith (18)
- # practicalli (12)
- # proletarian (1)
- # reagent (40)
- # reitit (23)
- # releases (1)
- # remote-jobs (1)
- # ring (14)
- # ring-swagger (1)
- # shadow-cljs (13)
- # sql (30)
- # testing (27)
- # tools-deps (31)
- # vim (10)
- # xtdb (4)
@ellahoeppner if you need custom headers you'll need a server anyways. so you should use the server you plan on using in production for development as well
Fair enough. Though the project I'm working on is just kinda a personal/prototyping thing and I doubt there will ever be a "production" version, so I was hoping for a simpler solution. I'll either look into making my own server or just using some old version of a browser that will let me use SharedArrayBuffers without special headers
Thanks for your help!
Hey there! I have a question regarding the dynamic configuration of the :dev-http
property. Suppose I have two http handlers configured in shadow-cljs.edn
. If I launch clj
and then call (start-server!)
, everything works as expected — I get two http servers:
$ cat shadow-cljs.edn
$ head -n 5 shadow-cljs.edn
{:deps true
:nrepl {:port 7888}
:socket-repl {:port 9002}
:dev-http {9666 {:handler dev.handler/handler}
9667 {:handler dev.handler2/handler}}
$ clj
Clojure 1.10.3
user=> (do (require '[shadow.cljs.devtools.server :as shadow.server])
(def config (shadow.server/load-config))
(shadow.server/start! config))
...
shadow-cljs - HTTP server available at # 1️⃣ First server
...
shadow-cljs - HTTP server available at # 2️⃣ Second server
...
:shadow.cljs.devtools.server/started
user=>
Now I would like to turn on the second http server using a CLI argument. I remove the second http server from shadow-cljs.edn
and configure it during runtime. For the simplicity of the example, I don't do any CLI arguments parsing here, but instead just prepare the config on the fly:
$ head -n 5 shadow-cljs.edn
{:deps true
:nrepl {:port 7888}
:socket-repl {:port 9002}
:dev-http {9666 {:handler dev.handler/handler}
#_#_9667 {:handler dev.handler2/handler}}
$ clj
Clojure 1.10.3
user=> (do (require '[shadow.cljs.devtools.server :as shadow.server])
(def config (shadow.server/load-config))
(def config* (assoc-in config [:dev-http 9667] {:handler 'dev.handler2/handler}))
(shadow.server/start! config*))
...
shadow-cljs - HTTP server available at # 1️⃣ Only the first server
...
:shadow.cljs.devtools.server/started
user=>
Though the configs are seemingly the same during runtime, second server doesn't start anymore.
I'd appreciate any pointers to the solution!When using the https://shadow-cljs.github.io/docs/UsersGuide.html#target-npm-module target, is there a way to not have the output export certain definitions? Ideally ones that are marked as private?
It looks possible :npm-library :node-library
using https://shadow-cljs.github.io/docs/UsersGuide.html#_dynamic_exports
Yes, :node-library
. Should have copy/pasted 😅
:npm-module
is pretty much dead anyways so prefer to use :node-library
if you can
@me1676 the dev-http stuff loads shadow-cljs.edn
again and does not respect server/start! arguments. it loads the config itself since it automatically adjusts the servers if you change them while running