Fork me on GitHub
#shadow-cljs
<
2019-08-17
>
Quest04:08:06

Sometimes I start up shadow-cljs via M-x cider-jack-in-cljs, but it fails with below output

[:app] Configuring build.
[:app] Compiling ...
shutting down ...
user> 
*** Closed on Fri Aug 16 21:22:00 2019 ***
Is there a way to view the exception causing compilation to fail, some sort of logs? In my scenario right now, running lein dev still works without any errors in the browser console on page load

thheller07:08:24

it isn't normal that it is shutting down immediately. so it is likely getting killing by your OS.

thheller07:08:44

could be just because it is running out of memory

thheller07:08:58

or could be for other reasons (eg. anti-virus)

thheller07:08:41

there likely is no exception to log. might also have something to do with cider-jack-in-cljs. not the slightest clue what that does.

thheller07:08:09

a rather old example showing how to integrate in a create-react-app app https://github.com/thheller/reagent-react-integration/blob/shadow-cljs/src/index.js

malch08:08:09

[thheller/shadow-cljs "2.8.48"] stopped working with Cider. It throws

[WARNING] No nREPL middleware descriptor in metadata of #'cider.piggieback/wrap-cljs-repl, see nrepl.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of #'cider.piggieback/wrap-cljs-repl, see nrepl.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of #'cider.piggieback/wrap-cljs-repl, see nrepl.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of #'cider.piggieback/wrap-cljs-repl, see nrepl.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of #'cider.piggieback/wrap-cljs-repl, see nrepl.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of #'cider.piggieback/wrap-cljs-repl, see nrepl.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of #'cider.piggieback/wrap-cljs-repl, see nrepl.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of #'cider.piggieback/wrap-cljs-repl, see nrepl.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of #'cider.piggieback/wrap-cljs-repl, see nrepl.middleware/set-descriptor!
[WARNING] No nREPL middleware descriptor in metadata of #'cider.piggieback/wrap-cljs-repl, see nrepl.middleware/set-descriptor!
Syntax error compiling var at (/tmp/form-init5310097246403534856.clj:1:9214).
Unable to resolve var: shadow.cljs.devtools.server.nrepl04/cljs-load-file in this context
on lein repl

thheller08:08:01

@malch it only stops working when you use custom stuff 😉

thheller08:08:08

in this case you need to adjust your middleware

thheller08:08:36

I changed it and there is only one now

malch08:08:26

trying now

thheller08:08:06

oh crap .. does cider still have hardcoded references to piggieback?

thheller08:08:03

I'm so tired of working around that mess 😛

malch08:08:43

besides, 2.8.48 for some reason changes my :init-ns

malch08:08:38

to shadow.user

malch08:08:36

I can stick with 2.8.47 for now, no problem here

thheller08:08:42

please describe the setup you use

thheller08:08:50

the default shadow-cljs.edn only setup shouldn't have changed

thheller08:08:59

as far as custom setups go I make no guarantees

malch08:08:41

{:lein true
 :nrepl {:port 9876}
 :builds {:app {:target :browser
                :output-dir "resources/public/js/compiled"
                :asset-path "/public/js/compiled"
                :modules {:app {:init-fn rpquest.main/main}}}}}

thheller08:08:14

the lein part I need. that is all fine

malch08:08:50

(defproject rpquest "0.1.0-SNAPSHOT"
  :min-lein-version "2.8.3"
  :source-paths ["src/clj" "src/cljc" "src/cljs"]
  :resource-paths ["resources"]
  :clean-targets ^{:protect false} ["resources/public/js/compiled"
                                    :target-path]
  :auto-clean false
  :dependencies [[aero "1.1.3"]
                 [aleph "0.4.7-alpha5"]
                 [integrant "0.7.0"]
                 [integrant/repl "0.3.1"]
                 [metosin/reitit "0.3.9"]
                 [metosin/ring-http-response "0.9.1"]
                 [org.clojure/clojure "1.10.1"]
                 [re-frame "0.10.8"]
                 [reagent "0.8.1"]
                 ;; [thheller/shadow-cljs "2.8.47"]
                 [thheller/shadow-cljs "2.8.48"]
                 ;; [thheller/shadow-cljs "2.8.42"] - yes
                 ;; [thheller/shadow-cljs "2.8.45"] - yes
                 ;; [thheller/shadow-cljs "2.8.47"] - yes
                 ]
  :profiles {:dev {:source-paths ["dev/clj"]
                   :repl-options {:nrepl-middleware [
                                                     ;; shadow.cljs.devtools.server.nrepl04/cljs-load-file
                                                     ;; shadow.cljs.devtools.server.nrepl04/cljs-eval
                                                     ;; shadow.cljs.devtools.server.nrepl04/cljs-select

                                                     shadow.cljs.devtools.server.nrepl04/middleware
                                                     ]}}
             :uberjar {:aot :all
                       :main rpquest.main }}
  :uberjar-name "rpquest.jar")

malch08:08:12

little messy, was testing simple_smile

thheller08:08:16

oh, yeah just find a bad thing in the nrepl init code

thheller08:08:27

the :init-ns thing was called mistakenly

thheller08:08:14

that looks all ok but where is your cider stuff?

malch08:08:22

oh, profiles.clj

malch08:08:30

{:user {:plugins [[lein-ancient "0.6.15"]
                  [jonase/eastwood "0.3.6"]
                  [lein-bikeshed "0.5.2"]
                  [lein-cljfmt "0.6.4"]
                  [lein-count "1.0.9"]
                  [lein-hiera "1.1.0"]
                  [lein-kibit "0.1.7"]]
        :dependencies [[nrepl "0.6.0"]]
        :aliases {"anc" ^{:doc "Check all dependencies for updates"}
                  ["do"
                   ["ancient" "check-profiles" ":all" ":check-clojure"]
                   ["ancient" ":all" ":check-clojure"]]
                  "anc-up" ^{:doc "Upgrade all dependencies interactively"}
                  ["do"
                   ["ancient" "upgrade" ":interactive" ":all" ":check-clojure"]
                   ["ancient" "upgrade-profiles" ":interactive" ":all" ":check-clojure"]]
                  "anc-snapshot" ^{:doc "Check all dependencies for updates, allow snapshots"}
                  ["ancient" ":allow-all" ":all" ":check-clojure"]
                  "dev" ^{:doc "Run development repl"}
                  ["repl" ":headless"]
                  "dev-clean" ^{:doc "Run fully clean development repl"}
                  ["-U" "do" "clean" ["repl" ":headless"]]
                  "deps-dev" ^{:doc "Run lein deps with repl profile"}
                  ["-U" "with-profile" "repl" "deps"]}}
 :repl {:plugins [[cider/cider-nrepl "0.22.0-beta10"]
                  [refactor-nrepl "2.5.0-SNAPSHOT"]]}}

thheller08:08:16

hmm I must be missing something. where is the cider nrepl middleware being configured?

malch08:08:55

:profiles {:dev {:source-paths ["dev/clj"]
                   :repl-options {:nrepl-middleware [
                                                     ;; shadow.cljs.devtools.server.nrepl04/cljs-load-file
                                                     ;; shadow.cljs.devtools.server.nrepl04/cljs-eval
                                                     ;; shadow.cljs.devtools.server.nrepl04/cljs-select

                                                     shadow.cljs.devtools.server.nrepl04/middleware
                                                     ]}}
             :uberjar {:aot :all
                       :main rpquest.main }}

malch08:08:08

:repl-options inside?

thheller08:08:22

thats the shadow-cljs middleware

thheller08:08:27

but where is cider?

malch08:08:45

:repl {:plugins [[cider/cider-nrepl "0.22.0-beta10"]
                  [refactor-nrepl "2.5.0-SNAPSHOT"]]}

malch08:08:58

that's all the config I needed

thheller08:08:19

hmm ok. I guess the plugins then add it dynamically

thheller09:08:50

@malch try 2.8.49. I added back the missing piggieback descriptor I deleted accidentally

malch09:08:20

sure, trying now

malch09:08:57

@thheller

Error loading shadow.cljs.devtools.server.nrepl04: Syntax error compiling var at (shadow/cljs/devtools/server/nrepl_impl.clj:21:5).
Syntax error compiling var at (/tmp/form-init1375884670700473546.clj:1:8600).
Unable to resolve var: shadow.cljs.devtools.server.nrepl04/middleware in this context

thheller09:08:02

I really need better test cases for this crap

malch09:08:43

sorry 😉

malch09:08:28

seems to be working, thank you!

👍 4