@ajsnow2012 should be fixed in latest version
@ghvanw283 the closure compiler does not support dynamic import()
so shadow-cljs doesn't either
@royalaid there is no CLJ funtion to connect to a remote server. that is all done from the npm bits. I guess you could do the same thing that does but there is nothing built-in for that from CLJ
Got it. Thank you so much for the reply @thheller
ok, thank you sir!
I’m getting a compile error I don’t understand.
1. In a CLJC file, in a #?@(:clj
block I require a couple of clj namespaces, using :as to name them.
2. In that same CLJC file, in a #?(:clj
form, I use those names to destructure keys on a map param.
I get this:
Does shadow parse :clj forms?
My guess is it’s this https://clojurians-log.clojureverse.org/shadow-cljs/2020-07-01
Yeah that was it. CLJC for everything or nothing.
how to run tests in shadow-cljs?
I have the following shadow-cljs.edn
that contains a test build
{:deps true
:source-paths ["src"]
:dependencies [[reagent "0.10.0"]
[re-frame "0.12.0"]
[re-frame-steroid "0.1.1"]
[rn-shadow-steroid "0.2.1"]
[re-frisk-remote "1.3.3"]
[cljs-ajax/cljs-ajax "0.8.1"]
[day8.re-frame/http-fx "0.2.2"]]
:builds
{:test {:target :browser-test
:test-dir "test/humboi"
:runner-ns humboi.core
:devtools {:http-port 8021
:http-root "test/humboi"}
}
:dev
{:target :react-native
:init-fn humboi.core/init
:output-dir "app"
:compiler-options {:closure-defines
{"re_frame.trace.trace_enabled_QMARK_" true}}
:devtools {:after-load steroid.rn.core/reload
:build-notify steroid.rn.core/build-notify
:preloads [re-frisk-remote.preload]}}}}
but running (shadow/watch :test) doesn’t run the tests
my tests are in the test/humboi directory
and the core.cljs contains
(cljs.test/run-tests)
I’m getting the following error:
Errors encountered while trying to parse file /Users/prikshetsharma/Desktop/Humboi/node_modules/react-native/index.js {:line 13, :column 7, :message “cannot use keyword ‘typeof’ here.“}
I am in search of examples using shadow cljs with replumb. Is anyone familiar with any example code?
Came across this thread in this channel previously, which describes that bootstrap shadow target is probably necessary.
For context, I’m debugging a replumb repl I have setup that doesn’t seem to have any symbols defined in the cljs/user
namespace. Basic types like 1
and 'this-is-a-keyword
work fine, but defs & any function call fails
I have a feeling it is related to the default init-fn! for replumb not working out-of-the-box with shadow: https://github.com/arichiardi/replumb/blob/dde2228f2e364c3bafdf6585bb1bc1c27a3e336c/src/cljs/replumb/browser.cljs#L4
this is my core_test.cljs
(ns humboi.core-test
(:require [humboi.core :as sut]
["@testing-library/react-native" :refer [render fireEvent]]
[humboi.auth.core :refer [google-sign-in-comp]]
[cljs.test :as t :include-macros true]))
(defn mount! [component]
(render (r/as-element component)
#js {:container (testing-container)}))
(deftest google-login-test
(is (mount! [google-sign-in-comp])))
(defn start [] (cljs.test/run-tests))
(defn stop [done]
;; stopping the tests
(done))
(defn ^:export init []
(start))
@ps ask in #cljsrn. I do not know anything about react-native testing but I do know that you cannot run them via :browser-test
or :node-test
@ritt93 use https://code.thheller.com/blog/shadow-cljs/2017/10/14/bootstrap-support.html instead of replumb
I will try to explain a rather complicated problem in my "English" ;)
I am trying to use macro with alter-var-root
to redefine how defn
and
defn-
.
(ns patch.tufte
(:require
[taoensso.tufte :as tufte :refer [p]]
[taoensso.encore :as enc]
#?(:clj
[cljs.core]))
#?(:cljs (:require-macros [patch.tufte])) <- Here's the problem!
)
...
...
#?(:clj
(alter-var-root #'cljs.core/defn (constantly #'defnp)))
#?(:clj
(alter-var-root #'cljs.core/defn- (constantly #'defnp-)))
If the specified line is not commented out when launching shadow, it looks like
cljs.core
is compiling with my new defn
.
However, if I uncomment the line after compiling the project for the first time,
everything works.
Can it be solved somehow?side-effects like that are not supported and will break just about everything shadow-cljs knows about compiling
Still, shadow-cljs it's awesome 🙂
Thanks as always for your work and quick reply.
@thheller is there any way to force recompilation of the ENTIRE project?
after compile time after using force-compile
in the dashboard it seems to me that this only compiles the latest changes
@huxley you can delete the cache in .shadow-cljs/builds/<build-id>
otherwise it'll always use the cache
need to restart the watch
after that though since that still everything in memory