Fork me on GitHub
#cursive
<
2020-03-15
>
Niclas13:03:42

What’s the state on shadow-cljs support? I’m trying to send pretty basic things to the repl but it keeps crashing, ex

(ns my.ns
  (:require ["react-native" :as react-native]
            [reagent.core :as reagent]))

(comment

  reagent.core => #js{...}

  (reagent/adapt-react-class react-native/View) => #object[reagent.impl.template.NativeWrapper]

  react-native => Error handling response - class java.lang.ClassCastException: class clojure.lang.PersistentVector cannot be cast to class java.lang.CharSequence (clojure.lang.PersistentVector is in unnamed module of loader .PluginClassLoader @61776d58; java.lang.CharSequence is in module java.base of loader 'bootstrap')
  )

cfleming21:03:37

You shouldn’t get an exception there. Just to be clear, it’s the symbol react-native that you’re sending to the REPL, right?

cfleming21:03:14

What does your shadow-cljs.edn look like?

cfleming21:03:21

I can try to reproduce that.

Ivar Refsdal12:03:09

I don't know your exact case @U0H9BVB98, but it looks like your REPL evaluation happens in JVM-world (not JS/browser). Have you tried evaluating something like (shadow/repl :client) before loading the statement? Where :client is the profile from :builds in shadow-cljs.edn.

Ivar Refsdal12:03:56

For my setup the following is shown (in JVM-world):

(shadow/get-build-ids)
=> (:npm :client :devcards :server :test :test-ci)

(shadow/repl :client)
To quit, type: :cljs/quit
=> [:selected :client]
And after this I have my piggiebacked REPL

Ivar Refsdal12:03:50

(+ 1 "asdf")
Execution error (ClassCastException) at shadow.user/eval33505 (REPL:1).
class java.lang.String cannot be cast to class java.lang.Number (java.lang.String and java.lang.Number are in module java.base of loader 'bootstrap')

(shadow/repl :client)
To quit, type: :cljs/quit
=> [:selected :client]

(+ 1 "asdf")
------ WARNING - :invalid-arithmetic -------------------------------------------
 Resource: :1:1
 cljs.core/+, all arguments must be numbers, got [number string] instead
--------------------------------------------------------------------------------
=> "1asdf"
I ❤️ JS 😉

Niclas14:03:06

@U0567Q30W Yes it’s the symbol I’m evaluating

{:paths
 ["src/"]

 :deps
 {reagent              {:mvn/version "0.9.0-rc3"}
  re-frame             {:mvn/version "0.11.0-rc3"}
  thheller/shadow-cljs {:mvn/version "2.8.81"}}

 :aliases
 {:dev {:extra-paths ["src/"]}}}

;; shadow-cljs.edn
{:deps
 {:aliases [:dev]}

 :builds
 {:app
  {:target           :react-native
   :init-fn          my.ns/init
   :output-dir       "out"
   :compiler-options {:infer-externs :auto}
   :devtools         {:autoload true}}}}