This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-06-27
Channels
- # announcements (5)
- # beginners (267)
- # boot (1)
- # calva (37)
- # cider (11)
- # clara (10)
- # clj-kondo (24)
- # cljsrn (13)
- # clojars (1)
- # clojure (119)
- # clojure-europe (5)
- # clojure-italy (19)
- # clojure-nl (11)
- # clojure-spec (18)
- # clojure-uk (99)
- # clojurescript (44)
- # clojurex (57)
- # community-development (6)
- # cursive (13)
- # datomic (92)
- # duct (12)
- # fulcro (1)
- # graalvm (4)
- # jobs (1)
- # kaocha (6)
- # luminus (3)
- # lumo (9)
- # off-topic (20)
- # pathom (6)
- # re-frame (21)
- # reagent (2)
- # reitit (9)
- # remote-jobs (4)
- # shadow-cljs (32)
- # spacemacs (3)
Hey guys. I’m trying running one http server on my Mac on port 8700. On a Windows VM, another http server is running on 3375. In my browser in Windows, when I hit my IP on 8700, everything works great. However, when I add main.js
as a script on one of the pages running on 3375 in Windows, when it loads, I’m getting the following errors:
If you look at the screenshot, it's asking for the goog scripts on localhost, but they aren't hosted there - it's on a different url and port
IUC, this looks like a job for the proxy. It'll search for files locally and forward to the proxy when not found
Is there like a one liner cli tool you know of to do that?
The problem is obvious - those files aren’t hosted on that port. Any suggestions on a solution? Some config in Shadow, perhaps?
If theres no easy fix on the shadow-cljs side, I can probably work things from the other direction.
@d4hines maybe this? https://github.com/fulcrologic/fulcro-inspect/blob/master/shadow-cljs.edn#L15
So if my shadow-cljs http server is hosting my code at http://my-ip:8700, I set :devtools-url to that?
> shadow-cljs will then use the :devtools-url as the base when making requests. It is not the final URL so you must ensure that all requests starting with the path you configured (eg. /shadow-cljs/*) are forwarded to the host shadow-cljs is running on.
Oh, this must be the prxy you mentioned in the thread
There's also support for a proxy: https://shadow-cljs.github.io/docs/UsersGuide.html#dev-http-proxy
@d4hines the default logic of shadow-cljs will try to load the JS from the current document location. so if you access the initial HTML via
it'll attempt to load the files from 8700
you can override that behavior via :devtools-url
or the proxy config as pointed out above
another thing that also works is just setting a full host in the :asset-path
config option. so :asset-path "
Ah! This helped a bunch! I’m so close now. The only remaining error is this one:
browser.cljs:343 WebSocket connection to ‘<ws://localhost:9630/ws/worker/app/60bb278c-7f0a-4cfc-9db2-5b4aec3572e5/2ddbda70-5ea9-4725-a1c2-1aa32811f7e4/browser>’ failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
For this, it looks like, according to 4.4.4 in guide, I need to set something like:
:http {:port 9630 :host "my-ip"}
I added that config, and I get the following output in the console:
shadow-cljs - server version: 2.8.39 running at
However, I still get the above error, where it’s looking for websockets on localhost.
I was just about to post that I did exactly that and it’s working!
Thanks a ton for your help!
The "build report" feature is not working for me: I run shadow-cljs run shadow.cljs.build-report <my-build-id> report.html
and it raises an error:
NoSuchFileException: .shadow-cljs/release-snapshots/dev/latest/main.js
Do I need to do some step before I run build-report?
@mauricio.szabo build reports currently only work with :browser
builds? do you use :browser
?
No, I'm using node_script. Sorry, I think I've missed this information on the documentation.
seems less important anyhow given that size is not really a concern for node-script builds
Also, how do I contribute to the documentation? On the "editor integration" part I could add Chlorine, socket REPL package for Atom, as it currently supports shadow-cljs out of the box 🙂