This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-01-27
Channels
- # announcements (10)
- # aws (11)
- # beginners (158)
- # calva (8)
- # cider (14)
- # clj-kondo (1)
- # cljsrn (1)
- # clojure (83)
- # clojure-europe (5)
- # clojure-italy (25)
- # clojure-nl (3)
- # clojure-spec (12)
- # clojure-uk (20)
- # clojurescript (72)
- # community-development (18)
- # core-async (4)
- # core-logic (19)
- # cursive (11)
- # datomic (21)
- # duct (6)
- # events (1)
- # figwheel-main (3)
- # fulcro (15)
- # ghostwheel (1)
- # jobs (1)
- # leiningen (16)
- # off-topic (45)
- # onyx (3)
- # pathom (7)
- # perun (1)
- # ring (3)
- # shadow-cljs (48)
- # spacemacs (10)
- # specter (1)
- # sql (24)
- # tools-deps (7)
- # vscode (7)
- # xtdb (14)
Hi, small question about lifecycle hooks, I have a re-frame app that defines this hook in it's core namespace:
(defn ^:dev/after-load mount-root []
(re-frame/clear-subscription-cache!)
(reagent/render [views/main-panel]
(.getElementById js/document "app")))
I've added a :workspaces build in shadow-cljs.edn to support https://github.com/nubank/workspaces/ Now, whenever I update the code, the workspaces app goes blank because of this hook. Is there a way to disable it for that build, but keep it for the regular build?
@ozfraier I would recommend splitting the namespaces so this can't happen. there is currently no way to disable hooks per build. you can move the hook config to the build though. so no meta but :devtools {:after-load
in the build config
@royalaid shadow-cljs never even opens the package.json
in your project. I assume you want to configure where it looks for actual npm packages and that you can configure per build via :js-options {:js-package-dirs ["addBankAccount/node_modules" ...]}
and structure wise I would probably keep all sources in <project>/src/main
and then just have it output separate files to <project>/lambdas/foo/...
so each lambda can have its own config and stuff in its own folder
Yeah, it's because the cli tools zip the dir and just upload it after running your build step so it has to be a specific shape π
I am sure I could make some magic happen but I would rather put that work towards business logic
When I mentioned a while back about wanting a better way to work with multiple shadow instances this is what I was asking about
hmm did I recommend not having multiple shadow instances back then? since that seems entirely unnecessary here π
so unless you need different versions of the same package it is not a problem to always load everything
FWIW I do this in shadow-cljs. all build configs in one shadow-cljs.edn and all deps in project.clj. then all the various output going to https://github.com/thheller/shadow-cljs/tree/master/packages
@thheller Thanks! I tried doing it but for some reason it didn't work, probably because I missed a turn somewhere. Eventually my setup had the workspaces app use an "#app" div just like my real app So I renamed it, and with some fiddling it seems to work now ^^;
ideally you would have a
or .core
or whatever namespace that handles all the initialization logic
Is there anyway to force shadow-cljs to bind to 0.0.0.0? I'm running shadow-cljs 2.8.83 and I'm my config is:
;; shadow-cljs configuration
{:source-paths
["src"
"test"]
...
:builds
{:dev
{:target :browser
:output-dir "resources/dev/public/js/compiled"
:asset-path "/js/compiled"
:js-options {:variable-renaming :local}
:modules {:app {:init-fn app.core/main}}
:devtools {:http-root "resources/dev/public"
:http-port 3449}}}}
the shadow-cljs dev http server
I'm not sure exactly, but I am not seeing it bound to 0.0.0.0
β¦ β― netstat -tulpn | rg LISTEN 09:35:16(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN -
tcp 0 0 0.0.0.0:5355 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:3000 0.0.0.0:* LISTEN 1313/puma 3.12.1 (t
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN -
tcp6 0 0 127.0.0.1:36585 :::* LISTEN 472/java
tcp6 0 0 127.0.0.1:35625 :::* LISTEN 472/java
tcp6 0 0 :::5355 :::* LISTEN -
tcp6 0 0 :::44179 :::* LISTEN 472/java
tcp6 0 0 ::1:3000 :::* LISTEN 1313/puma 3.12.1 (t
tcp6 0 0 :::3449 :::* LISTEN 472/java
tcp6 0 0 :::3451 :::* LISTEN 472/java
tcp6 0 0 :::9630 :::* LISTEN 472/java
yeah, I thought that would have worked too.
My work has a kind of complicated dev set-up and I am trying to get it to work on Windows + WSL. I have shadow-cljs running on WSL and I can connect to it when using localhost:3449 from Windows. But generally my work uses and has code set-up to handle our dev environment from the url *.
(for info on https://readme.localtest.me/). And when I try to connect to shadow-cljs on Windows from
it can't find it. I'm trying to debug this and see if it's because it's not listening specifically on 0.0.0.0. The thought that led me down that path is because a rails webserver listening on port 3000 and bound to 0.0.0.0 is able to be reached by
on Windows.
I'm on windows/wsl too but never tried http://localtest.me
Just a heads up, I've done some more testing on this using just node and both WSL and WSL2. With node, binding to port ::
and 0.0.0.0
behaves the same on WSL. IE They're both accessible from
. However, in WSL2 (which is what I run) only 0.0.0.0
is accessible from
. So it looks like WSL2 is not correctly handling ::
.
Thanks again, talking to someone else running WSL really helped narrow this down.
I don't really know. the default is to listen on 0.0.0.0 and thats I all pass into it
Ok it must be something on my end then. I just tried recreating the acme-app from https://github.com/thheller/shadow-cljs#quick-start, and again I could connect on localhost:8080
but not
Thanks for the help π