- several times per 10mins
- many times per hour
- like once an hour
- like once in days
If you ever restart it for any other reason than upgrading/changing
shadow-cljs itself please let me know why!
I might have a solution for having to restart due to
:dependencies but nothing yet.
The main reason I restart besides dependency change is that I seem to frequently (every few hours) get a “too many open files” error, and a restart fixes that. Haven’t spent any more time looking at the cause.
I got many…
The main difference is I have too many tiny projects, whose configurations are slightly different from each other. And I have to restart as soon as something got changed or mistaken.
Can you provide more information? That is definitely not normal. I don’t think that I’m leaking file descriptors but maybe I do?
npm doesn’t require a restart. However there is currently no way to “trigger” a recompile manually. You can do
$ shadow-cljs clj-repl (shadow/stop-worker :your-build) (shadow/watch :your-build)
Changing build configuration automatically triggers a rebuild and doesn’t require restarts. Only changes to actual server stuff requires a restart but this will also be fixed at some point.
shadow/stop-worker would fix part of my 3rd problem.
For the “wrong config” part. If I forgot to set the right port, like port for socket REPL, or static HTTP server, does shadow-cljs update? I have too many copies of shadow-cljs to make myself confused.
If at all possible never use hard coded ports for the REPLs. You should never enter them by hand and instead when using a tool read the matching
target/shadow-cljs/*.port files. It uses random ports by default to avoid any kind of conflicts but you can always find the current port from those files.
Static HTTP servers do not yet restart on config change but I can add that. You can also add
:http-port 0 to use a random port which you can then find via the
:socket-repl, I don’t use it often at current. Just don’t be really random when I want to find the port.
target/shadow-cljs/*.port files , … you can always find the current port from those files.
It’s not hardcoded in my editor. I think it might be nice solution, but my editor doesn’t look up ports in that way yet. My editor starts up in 1s while shadow-cljs is still starting. Besides, I’m not sure about the relative path.
You can also add :http-port 0 to use a random port
I think Webpack’s strategy is fine in my case: try
8080, if not available then
8081, print logs of
http://localhost:8081 is already in my history. It’s convenient. I restart watching server only when I found ports conflicted.
you can then find via the http://localhost:9630 interface.
Which port defaults to
9630? I constantly got errors of port is already used because sometimes I have to start 3 watching servers in the meantime. I don’t know what it’s used… but just don’t want conflicts.
trying to show how frequently I switch among projects…
How about changing
:source-paths, does shadow-cljs reload?
They affect the classpath and that is static.
I am guilty of hardcoding the port as well. Very very convenient indeed