Hey guys. I have setup a shadow-cljs project with deps.edn. When I run the
clj -A:shadow-cljs-dev watch app
command I get a server up and running and things are great. But after I quit it with "ctrl + z" the server lingers forever. I can go to localhost:8700 and still see my app running there. If I restart the watch app then it will says that my build is stale and was not produced by the current watcher. Only workaround is to change the port.
Anyone know how to fix this? Reboot doesn't help either. So something is cached somewhere?Why do you quit with "Ctrl+Z" and not "Ctrl+C"?
I did "Ctrl + C" in the beginning and it had the same effect. So I checked the shadow-cljs documentation and I believe there they mentioned ctrl+z. Either way both have the same outcome :/
Shadow-cljs does not mention "Ctrl+Z".
"Ctrl+Z", if you use it in some common terminal without redefining any keys, sends SIGTSTP
that suspends the foreground process - it doesn't stop it. In fact, you can bring it back with the fg
command (assuming bash
-like shell).
"Ctrl+C" should work with the shadow-cljs
executable or with npx shadow-cljs
or something like that.
Why it doesn't work for you depends on what your :shadow-cljs-dev
alias does.
Hmmm.. I must have confused myself then. >< The alias is this:
:shadow-cljs-dev
{:extra-deps {thheller/shadow-cljs {:mvn/version "RELEASE"}
re-frame/re-frame {:mvn/version "1.1.2"}
binaryage/devtools {:mvn/version "1.0.2"}
re-frisk/re-frisk {:mvn/version "1.3.5" :exclusions [com.google.code.findbugs/jsr305
re-frame/re-frame]}}
:main-opts ["-m" "shadow.cljs.devtools.cli"]}
I would expect "Ctrl+C" to work just fine in this case - I would ask in #shadow-cljs
Oh I didnt know about that channel. Thanks! π
Hi ! I wonder to know what's the solution to import ES6 default export in vanilla CLJS since this issue? https://clojure.atlassian.net/browse/CLJS-2376
@wei FYI, I had sucess with experimentation using Shadow-CLJS since it provides :default
to import the lib like this
["react-native-alarm-clock" :default AlarmClock]
For the moment, no success with vanilla CLJS using Krell.
With Krell I tried to import like this but no success
["react-native-alarm-clock" :refer [default] :rename {default AlarmClock}]
So @wei The full code you can tried:
(ns awesome-project.core
(:require [reagent.core :as r]
[reagent.react-native :as rn]
["react-native-alarm-clock" :as clock]))
(defn create []
(let [date (js/Date.)]
(.createAlarm (.-default clock) (.toISOString date) "My alarm")))
(defn hello []
[rn/view {:style {:flex 1 :align-items "center" :justify-content "center"}}
[rn/text {:style {:font-size 50}} "Hello Krell!"]
[rn/button {:on-press #(create)
:title "Add alarm"}]])
(defn ^:export -main [& args]
(r/as-element [hello]))
The doc from the ib doesn't mention this, but don't forget to add the alarm permission.
Add this line in your ./android/app/src/main/AndroidManifest.xml
:
<uses-permission android:name="com.android.alarm.permission.SET_ALARM" />
thanks so much for following up MichaΓ«l! your answers have been really helpful for me getting up and running with cljs + rn.
everything worked after adapting your code example and adding the permission to the manifest.
I do regullary with Shadow-CLJS since it provide :default
in ns but vanilla CLJS doesn't adopt it.
https://clojure.atlassian.net/browse/CLJS-2376