Hello everyone! I'm using shadow-cljs 3.3.6 and I'm trying to get it to proxy to my webserver which is listening on localhost:3000. Shadow-cljs is running my dev-http on 8000 and I have a proxy url configured. :dev-http {8000 {:root "resources/public" :proxy-url ". However, when I now open my webapp on localhost:3000, I get a 404. 😮 In the https://shadow-cljs.github.io/docs/UsersGuide.html#dev-http-proxy the URL used is not localhost. Could it be that this is occurring because both are pointing to localhost and localhost:3000 doesn't have anything under /?
Hm, no, I also just tried using 127.0.0.1:3000 instead of localhost and I also tried using an alias set in /etc/hosts
why are you using a proxy in the first place? can you not just make the server on :3000 serve the static .js files?
if you are talking to :3000 directly then the shadow-cljs.edn config will have absolutely nothing to do with it. so the 404 is coming from your server?
maybe you are expecting the :8000 server to server resources/public/index.html? in that case you might want to add :use-index-files true do the :dev-http config for 8000?
Oh it seems I misunderstood something. I thought configuring proxy-url would make the shadow-cljs dev server proxy certain URLs. Is that's not what it’s for? That would explain why I didn’t have to configure a route to proxy. I'll probably just try to make my server serve the files, then.
proxy url proxies requests from the :dev-http to the :proxy-url. not the other way. it can't do anything with request going to proxy-url directly.
Thanks for clearing that up
Can I perhaps make a guix source package out of a shadow-cljs frontend? Guix has node-build-system and clojure-build-system. If neither build system is good enough, I can perhaps write a new build system after learning guix.
no clue what guix is or what that entails. if its just esm files then :target :esm probably just works.
It's like nix. Every dependency is a package in /guix/store/package_hash-package_name-version. They are combined with environment variables like JVM_CLASSPATH="/guix/store/xxx-clojure-1.0:/guix/store/xxx-missionary-1.0:...". JVM classpath can be built like this?
I guess npm dependencies are directly inserted into dependent packages as symlinks without environment variable.
I suspect shadow-cljs works with this without internet access once all dependencies are gathered in node_modules and JVM classpath by guix. I will probably have to write new guix build systems for this.
If it doesn't work out, I can fall back to uberjars... and other forms of binary build.
I want to turn clojure and clojurescript into first-class citizens on gnu guix. Right now, guix users just use clj from clojure-tools. I suspect I just need to write a guix build system or two, or three for this. If I assemble node_modules symlinks and JVM classpath from guix store paths, then maybe it all works out.
Do you think it can work?
no clue. don't know guix. I'm deeply skeptical of one package manager wrapping another wrapping another, so not something I think is worth doing.
that being said .. shadow-cljs is basically just a clojure library. it runs anywhere if you have something that can construct a proper classpath for it. I wrote about that a long time ago https://code.thheller.com/blog/shadow-cljs/2017/11/18/the-many-ways-to-use-shadow-cljs.html
Linux distribution package maintainers wrote complex code for python packages, but guix and guile scheme make it relatively simple as long as you understand individual language-specific build systems. I think you are right to be skeptical if you don't see value in installing dependencies as linux distribution packages. Most clojure projects are proprietary projects which end up in uberjars anyway... I just like doing everything through linux distribution packages if that can be done in a reasonable timeframe.
I realized that replicating the build steps in guix is going to be duplication of work. Perhaps, it's best to just make guix packages out of pre-built binaries like uberjars. This way, I can still get declarative system configuration without having to learn and duplicate build steps.
Okay, I decided to focus on app development instead of infrastructure development. Guix will be used like ansible, but I will make guix packages out of pre-built binaries.
When I have spare money in my business, I can perhaps hire someone to write guix source packages... But, I personally won't.
Does shadow-cljs or clojurescript support javascript import map?
thats not a build tool question. thats a runtime question. as in import maps tell the runtime where to find dependencies. and yes shadow-cljs supports building code that can make use of import maps