Hello! Did anyone try to use shadow-cljs from devcontainers? I found that it works much better than WSL but hot reloading is not working for some reason. Any ideas why could it be?
I haven't, but just in case you didn't know: shadow-cljs, npm, and clojure run perfectly fine directly on Windows. No need for either WSL or any kind of container
I honestly don't even know what devcontainers are 😛
but by having container in the name I'm assuming its virtualized which might mean that file watching doesn't work
maybe :fs-watch {:polling true}
in shadow-cljs.edn
makes it work
It's just a docker container with needed runtime and vscode service.
{:nrepl {:port 8777}
:source-paths ["src/cljs"]
:fs-watch {:polling true}
:builds {:app {:target :browser
:output-dir "resources/public/js/compiled"
:asset-path "/js/compiled"
:modules {:app {:init-fn mui.core/init}}
:autobuild true
:devtools {:http-root "resources/public"
:http-port 8280
:autobuild true
:preloads [devtools.preload]}}}
:devtools {:after-load mui.core/start}}
Is it correct?yes
@thheller Can I see somehow this config? https://github.com/thheller/shadow-cljs/blob/b05b8f41afd45564ef7b9831a07201d09a5c4a07/src/main/shadow/cljs/devtools/server/fs_watch_hawk.clj#L43
what do you mean see? this is the :fs-watch
map?
but the hawk watcher is only used on macOS
oh hmm right that might mean that :polling true
doesn't actually do anything since it is a hawk only option 😛
I found the solution https://github.com/wkf/hawk/issues/10#issuecomment-173656507 and tried it with Hawk. For now I'll try to force Hawk in the container
Yes, it's working! @thheller, could I create a pull request?
for?
for forcing the use of Hawk in config
I've made a change into the shadow.cljs.devtools.server.fs-watch
file
- (if (and (str/includes? os-name "Mac") (not (false? (:hawk config))))
+ (if (not (false? (:hawk config)))
and config
:fs-watch {:watcher :polling
:hawk true}
After these changes, hot reloading finally started to work!By default hawk is false so there is shouldn't be a problem
definitely not doing that
but I'm ok with testing :hawk true
Thank you so much for your help! Should I create an issue instead? It still needs to be supported in the codebase since devcontainer is a Docker container and OS in it is Linux and it will fail (str/includes? os-name "Mac")
precondition.
create an issue. I'll think about it.