Fork me on GitHub
#shadow-cljs
<
2021-01-26
>
AJ Snow00:01:48

yeah that's what I thought at first but after struggling for a few days I started reaching I guess. knowing it's just supposed to be js, I'm going to try targeting node next and see if that works, thank you for your input!

kimim00:01:25

Hello, I get this error, when use shadow-cljs in WSL ubuntu on Windows, can anyone help? thanks. shadow-cljs - config: /home/kimim/workspace/vorstellung/shadow-cljs.edn shadow-cljs - updating dependencies shadow-cljs - dependencies updated Execution error (AssertionError) at shadow.build.classpath/process-root-contents (classpath.clj:593). Assert failed: (sequential? root-contents)

thheller01:01:15

@kimi.im my guess is that you don't have a :source-paths vector? maybe a set or map?

thheller01:01:24

@ajsnow2012 you don't have to look at node either. unless you need some type of server of course. look literally for "static website"

kimim01:01:17

It is set correctly :source-paths ["src/cljs"] The same setting, works in Linux or windows environment. But WSL failed..

thheller01:01:39

I use WSL too and never had an issue

thheller01:01:44

what is the rest of the stacktrace?

kimim01:01:53

Hello @thheller, the full error looks like this: {:clojure.main/message "Execution error (AssertionError) at shadow.build.classpath/process-root-contents (classpath.clj:593).\nAssert failed: (sequential? root-contents)\n", :clojure.main/triage {:clojure.error/class java.lang.AssertionError, :clojure.error/line 593, :clojure.error/cause "Assert failed: (sequential? root-contents)", :clojure.error/symbol shadow.build.classpath/process-root-contents, :clojure.error/source "classpath.clj", :clojure.error/phase :execution}, :clojure.main/trace {:via [{:type java.lang.AssertionError, :message "Assert failed: (sequential? root-contents)", :at [shadow.build.classpath$process_root_contents invokeStatic "classpath.clj" 593]}], :trace [[shadow.build.classpath$process_root_contents invokeStatic "classpath.clj" 593] [shadow.build.classpath$process_root_contents invoke "classpath.clj" 593] [shadow.build.classpath$find_jar_resources invokeStatic "classpath.clj" 670] [shadow.build.classpath$find_jar_resources invoke "classpath.clj" 638] [shadow.build.classpath$find_resources invokeStatic "classpath.clj" 767] [shadow.build.classpath$find_resources invoke "classpath.clj" 758] [shadow.build.classpath$index_path_STAR_ invokeStatic "classpath.clj" 997] [shadow.build.classpath$index_path_STAR_ invoke "classpath.clj" 994] [clojure.lang.PersistentVector reduce "PersistentVector.java" 343] [clojure.core$reduce invokeStatic "core.clj" 6827] [clojure.core$reduce invoke "core.clj" 6810] [shadow.build.classpath$index_classpath$fn__10836$fn__10837 invoke "classpath.clj" 1130] [clojure.lang.Atom swap "Atom.java" 37] [clojure.core$swap_BANG_ invokeStatic "core.clj" 2352] [clojure.core$swap_BANG_ invoke "core.clj" 2345] [shadow.build.classpath$index_classpath$fn__10836 invoke "classpath.clj" 1130] [shadow.build.classpath$index_classpath invokeStatic "classpath.clj" 1129] [shadow.build.classpath$index_classpath invoke "classpath.clj" 1124] [shadow.build.classpath$index_classpath invokeStatic "classpath.clj" 1126] [shadow.build.classpath$index_classpath invoke "classpath.clj" 1124] [shadow.cljs.devtools.server.common$fn__15586 invokeStatic "common.clj" 92] [shadow.cljs.devtools.server.common$fn__15586 invoke "common.clj" 90] [clojure.lang.AFn applyToHelper "AFn.java" 154] [clojure.lang.AFn applyTo "AFn.java" 144] [clojure.core$apply invokeStatic "core.clj" 665] [clojure.core$apply invoke "core.clj" 660] [shadow.runtime.services$start_one invokeStatic "services.clj" 98] [shadow.runtime.services$start_one invoke "services.clj" 87] [shadow.runtime.services$start_many$fn__9395 invoke "services.clj" 127] [shadow.runtime.services$start_many invokeStatic "services.clj" 126] [shadow.runtime.services$start_many invoke "services.clj" 105] [shadow.runtime.services$start_all invokeStatic "services.clj" 144] [shadow.runtime.services$start_all invoke "services.clj" 139] [shadow.cljs.devtools.server$start_system invokeStatic "server.clj" 340] [shadow.cljs.devtools.server$start_system invoke "server.clj" 202] [shadow.cljs.devtools.server$start_BANG_ invokeStatic "server.clj" 483] [shadow.cljs.devtools.server$start_BANG_ invoke "server.clj" 385] [shadow.cljs.devtools.server$start_BANG_ invokeStatic "server.clj" 388] [shadow.cljs.devtools.server$start_BANG_ invoke "server.clj" 385] [shadow.cljs.devtools.server$from_cli invokeStatic "server.clj" 615] [shadow.cljs.devtools.server$from_cli invoke "server.clj" 591] [clojure.lang.AFn applyToHelper "AFn.java" 160] [clojure.lang.AFn applyTo "AFn.java" 144] [clojure.lang.Var applyTo "Var.java" 705] [clojure.core$apply invokeStatic "core.clj" 665] [clojure.core$apply invoke "core.clj" 660] [shadow.cljs.devtools.cli_actual$lazy_invoke invokeStatic "cli_actual.clj" 23] [shadow.cljs.devtools.cli_actual$lazy_invoke doInvoke "cli_actual.clj" 20] [clojure.lang.RestFn invoke "RestFn.java" 460] [shadow.cljs.devtools.cli_actual$blocking_action invokeStatic "cli_actual.clj" 129] [shadow.cljs.devtools.cli_actual$blocking_action invoke "cli_actual.clj" 116] [shadow.cljs.devtools.cli_actual$main invokeStatic "cli_actual.clj" 177] [shadow.cljs.devtools.cli_actual$main doInvoke "cli_actual.clj" 132] [clojure.lang.RestFn applyTo "RestFn.java" 137] [clojure.core$apply invokeStatic "core.clj" 669] [clojure.core$apply invoke "core.clj" 660] [shadow.cljs.devtools.cli_actual$_main invokeStatic "cli_actual.clj" 219] [shadow.cljs.devtools.cli_actual$_main doInvoke "cli_actual.clj" 217] [clojure.lang.RestFn applyTo "RestFn.java" 137] [clojure.lang.Var applyTo "Var.java" 705] [clojure.core$apply invokeStatic "core.clj" 665] [clojure.core$apply invoke "core.clj" 660] [shadow.cljs.devtools.cli$_main invokeStatic "cli.clj" 75] [shadow.cljs.devtools.cli$_main doInvoke "cli.clj" 67] [clojure.lang.RestFn applyTo "RestFn.java" 137] [clojure.lang.Var applyTo "Var.java" 705] [clojure.core$apply invokeStatic "core.clj" 665] [clojure.main$main_opt invokeStatic "main.clj" 514] [clojure.main$main_opt invoke "main.clj" 510] [clojure.main$main invokeStatic "main.clj" 664] [clojure.main$main doInvoke "main.clj" 616] [clojure.lang.RestFn applyTo "RestFn.java" 137] [clojure.lang.Var applyTo "Var.java" 705] [clojure.main main "main.java" 40]], :cause "Assert failed: (sequential? root-contents)"}}

thheller01:01:34

which java version?

thheller01:01:07

yeah its a bad .jar file on the classpath causing this

thheller01:01:22

something that pretends to be a .jar but isn't

thheller01:01:34

most likely from your java dist

kimim01:01:26

openjdk 11.0.10 2021-01-19 OpenJDK Runtime Environment GraalVM CE 21.0.0 (build 11.0.10+8-jvmci-21.0-b06) OpenJDK 64-Bit Server VM GraalVM CE 21.0.0 (build 11.0.10+8-jvmci-21.0-b06, mixed mode, sharing)

thheller01:01:38

you can set :log {:level :debug} in your shadow-cljs.edn. that should then log which one causes the trouble

đź‘Ť 3
kimim01:01:35

Thanks. It says one deps jar is empty: [2021-01-26 09:14:44.403 - FINE] :shadow.build.classpath/bad-jar - {:file #object[http://java.io.File 0x7b8bf5c0 "/home/kimim/.m2/repository/commons-io/commons-io/2.6/commons-io-2.6.jar"]} ZipException zip file is empty

thheller01:01:20

just delete it

thheller01:01:24

redownload probably fixes it

kimim01:01:51

It works now. Thanks.

đź‘Ť 3
zimablue08:01:07

hey, I'm getting an issue using node when I try to require a cljs file which itself requires a string path javascript file, but I don't really get a stack trace, just "failed to import" and then "SHADOW ERROR" and the path

zimablue08:01:22

sorry SHADOW import error

zimablue08:01:05

I made progress, that file is in my output watch artifact, I manually modified it to log the error, which told me the problem was another missing module: Module not provided: shadow.js.shim.module$chai, however this module is in the root node_modules

thheller09:01:19

@zimablue I don't understand what you mean by however this module is in the root node_modules. what is your build config and how are you running it?

zimablue10:01:45

hi Mr Heller, the overall purpose is to try and test datascript which I am consuming through javascript, so in my actual project I use datascript though javascript which works fine but can't debug it, I was trying to jam part of my javascript project in as a datascript-repl dependency so I could use clojure debugging and understand the Clojure project, To that end I am connecting calva to a node-library build, the repl works and I can import datascript modules. I then just dumped my javascript node_modules and output lib into a subdirectory of the datascript project. It works to some extent but fails to resolve when one javascript file imports another, my build looks like this:

zimablue10:01:01

builds {:node {:target :node-library ;; :main {:entries [test_node.js]} :js-options {:js-package-dirs ["vscodelib", "node_modules"] ;; :js-provider :require } :output-to "./lib" :exports {:dunno datascript.js/keywordize}}

zimablue10:01:20

and the error I get after I manually overwrite my output artifact to print the error is:

zimablue10:01:41

shadow-cljs - failed to load module$vscodelib$test$databasespec SHADOW import error /home/zimablue/projects/readlib/datascript/.shadow-cljs/builds/node/dev/out/cljs-runtime/marc.js Module not provided: shadow.js.shim.module$chai

zimablue10:01:06

Chai being a javascript dependency of the javascript file which I am importing

zimablue10:01:24

sorry, please don't waste any time on this since I am very new so it's certainly a failure of my understanding

zimablue10:01:35

but if you can immediately guess the problem that would be cool also

thheller10:01:17

yeah sorry I can't help much. it seems like you are trying to do something weird but I don't understand what

thheller10:01:47

cljs-runtime/marc.js suggests you have a (ns marc) which I don't see in your config so no clue

thheller10:01:10

:js-package-dirs ["vscodelib", "node_modules"] this is also suspect. why are you doing this?

thheller10:01:25

no clue how chai plays into all of this. datascript doesn't use it.

thheller10:01:06

"dumped my javascript node_modules and output lib into a subdirectory" this will definitely not work and is not supposed to

zimablue11:01:52

what is the recommended alternative approach for consuming js code? it has to be formatted as npm packages?

thheller11:01:36

it sounds to me like you want the opposite route? consume the CLJS code in a JS build? if your code is mostly JS?

zimablue11:01:09

I'm doing that successfully, the reason for this reversal is for development, so that I can debug a clojurescript library using clojurescript repl/tooling

thheller11:01:41

debug "where"?

thheller11:01:48

I mean where is the final JS running?

thheller11:01:08

:node-library isn't really meant to be re-bundled. it is meant to be used in node directly. (as the name implies 🙂)

zimablue11:01:31

the final js is intended to run as you said, consuming the clojurescript, this is just intended to run in my repl/run tests so I can poke around the clojurescript dependencies

zimablue11:01:46

(this alternative setup)

zimablue11:01:21

since it's hard to use javascript tools to understand what clojurescript libraries are doing with your datastructures I tried to set up a version of the reverse setup to enable me to use cljs tooling

thheller11:01:48

ok. what kind of JS code do you have? plain standard ES6+ code or some kind of other dialect? JSX? etc?

zimablue11:01:05

it's typescript which has been compiled to es5 modules

zimablue11:01:39

I'm certain that's what happens, but not sure that my description is useful

thheller11:01:39

better to compile to es8 or so but es5 isok

zimablue11:01:07

thanks, I have looked at this document but not read every line, I will reread this section

zimablue11:01:09

thank you for your help

thheller11:01:00

you may also try :npm-module which will might work better for your use-case

zimablue11:01:03

ah yes I read this section, then by trial and error made it work by requiring in my cljs like this: (ns marc (:require ["/vscodelib/test/databasespec.js" :as foo])) That call works, but when databasespec.js has a further dependency (require("chai")), that's when I get the error I pasted

zimablue11:01:11

I will try npm-module

zimablue11:01:43

I started to read the shadow-cljs source code but it seems fairly complex

thheller11:01:47

so you have :source-paths ["src"] and src/vscodelib? the :js-package-dirs is misleading here and probably causing issue

zimablue11:01:23

yes I have both of those, I think that was what worked (or at least gave me a new error message) by trial and error

thheller11:01:38

ideally the code you use this way uses ESM syntax so not require("chai") but import Foo from "chai"

zimablue11:01:12

(ns marc (:require ["/vscodelib/test/databasespec.js" :as foo]))

thheller11:01:34

what is your :source-paths?

zimablue11:01:53

sorry wrong paste

thheller11:01:01

vscodelib makes me suspicious. is this running as a vscode plugin of some kind?

zimablue11:01:13

{ :verbose true :log {:level :debug} :source-paths [ "src" ] :dependencies [[persistent-sorted-set "0.1.2"]] :builds {:node {:target :node-library ;; :main {:entries [test_node.js]} :js-options {:js-package-dirs ["vscodelib", "node_modules"] ;; :js-provider :require } :output-to "./lib" :exports {:dunno datascript.js/keywordize}}}}

thheller11:01:31

ok so the above would look for src/vscodelib/test/databasespec.js

zimablue11:01:39

yes which is where it is

zimablue11:01:51

that part I believe works, it's the next dependency resolution, js=>js

thheller11:01:22

so that JS file has a require("chai")?

zimablue11:01:46

which I think is the result of a typescript compilation with target "es5"

thheller11:01:39

well it should not have require at all. it should have import

thheller11:01:54

but require should also work

thheller11:01:00

how are you running any of this?

zimablue11:01:43

I start shadow-cljs server, shadow-cljs watch node, npm=>import "./lib" and then finally through calva connect to the running repl

zimablue11:01:00

sorry if that's a pedantic description as you can tell I'm new to this ecosystem

thheller11:01:02

npm=>import "./lib" what does that mean?

zimablue11:01:14

• "node => import lib"

zimablue11:01:23

i start node in a terminal then import the output artifact

zimablue11:01:33

which provides the runtime (?)

thheller11:01:00

please post what exactly you are doing. you are forcing me to guess which helps noone.

zimablue11:01:03

as in (calva) <=> (shadow-cljs watch) <=> (node with loaded code)

zimablue11:01:14

I was trying to be precise

thheller11:01:20

you are literally running node and then import lib? that is invalid?

zimablue11:01:41

no I run node and then "require("lib")

zimablue11:01:46

sorry I got the verbs confused

thheller11:01:08

please be more precise

thheller11:01:25

require("lib") this would be looking for node_modules/lib? which no output is going to

thheller11:01:48

I need to understand what you are doing to provide any kind of help

zimablue11:01:58

lib is where the node watch process outputs the javascript artifact

zimablue11:01:13

this line in my shadow-cljs.edn: :output-to "./lib"

zimablue11:01:17

I believe configures that

thheller11:01:32

yes. but require("lib") will NOT look for that output at least not with the default node configuration

zimablue11:01:48

it's require ("./lib")

thheller11:01:13

ok first of all why are you doing this at all?

thheller11:01:27

why not just shadow-cljs node-repl or that via Calva?

thheller11:01:16

but ok, lets try to make this work

zimablue11:01:25

I think I tried that and it didn't work, so I tried to run the individual commands

thheller11:01:32

you open node. you run require("./lib"). what happens next?

zimablue11:01:38

to at least vaguely understand what what happening

zimablue11:01:56

then I go to calva and do "connect to running repl", some magic happens and I can communicate with that process

thheller11:01:05

no. what happens in the node process

thheller11:01:11

not interested in calva at this time

zimablue11:01:31

I get this output

zimablue11:01:44

> require("./lib") { dunno: [Getter] } > shadow-cljs - #6 ready!

thheller11:01:57

ok that appears to work fine then

thheller11:01:18

now please run shadow-cljs cljs-repl node

thheller11:01:43

then eval something like :foo just to verify the connection works

zimablue11:01:40

the shadow-cljs cljs-repl node gives "shadow-cljs: command not found"

thheller11:01:03

ok if you don't have the global install run npx shadow-cljs cljs-repl node instead

zimablue11:01:20

yes sorry I see I was using npx for the others

zimablue11:01:39

it connects and runs simple commands

thheller11:01:51

ok and what command did you run to "break" things?

zimablue11:01:09

(require 'marc)

thheller11:01:33

ok and that still breaks things now? trying to take calva out of the equation here

thheller11:01:59

with what error? the above Module not provided I assume?

zimablue11:01:55

same problem: shadow-cljs - failed to load module$vscodelib$test$databasespec SHADOW import error /home/zimablue/projects/readlib/datascript/.shadow-cljs/builds/node/dev/out/cljs-runtime/marc.js now before I had gotten more information about the error by modifying the output "lib" artifact and adding a line which logs the error

thheller11:01:56

remove :exports {:dunno datascript.js/keywordize}} from your build config and instead use :exports {:dunno marc/foo}}

zimablue11:01:59

and if I repeat that I get

zimablue11:01:00

shadow-cljs - failed to load module$vscodelib$test$databasespec SHADOW import error /home/zimablue/projects/readlib/datascript/.shadow-cljs/builds/node/dev/out/cljs-runtime/marc.js Module not provided: shadow.js.shim.module$chai /home/zimablue/projects/readlib/datascript/.shadow-cljs/builds/node/dev/out/cljs-runtime/marc.js

zimablue11:01:11

referring to the js=> js import

thheller11:01:56

need to have an actual def in that ns though. you can use any you already have or just add (def foo 3)

thheller11:01:16

point is getting that ns into the initial build so we can get to the error "earlier", ie. trigger it on build or on load, not the REPL

thheller12:01:48

also remove :js-options completely

zimablue12:01:38

before i removed js-options, you are right this moved the error from the repl stage to the node require("./lib") stage

zimablue12:01:47

trying without js-options

thheller12:01:08

ok, I'm guessing you are running into a variant of this https://github.com/thheller/shadow-cljs/issues/832

thheller12:01:37

so, try node then global.shadow$provide = {}; then require("./lib")

zimablue12:01:42

same result without js-options

thheller12:01:43

also I don't understand why you are not getting that error

thheller12:01:58

can you share this file src/vscodelib/test/databasespec.js?

zimablue12:01:13

without js-options and with the suggested node argument I get the same error

thheller12:01:40

ok var datascript_1 = require("datascript"); this is a problem and probably causing all the rest

thheller12:01:54

that will include the npm datascript package. not the one compiled by shadow-cljs you are doing all this for

roelof12:01:32

any shadow-expert who can help me with this How to solve this one :

cljs꞉cljs.user꞉>  @state/orders
nil
; No available JS runtime.
clj꞉cljs.user꞉>  @state
shadow-cljs.edn
{:source-paths ["src"]

 :dependencies [[binaryage/devtools "0.9.10"]
                [proto-repl "0.3.1"]
                [reagent "0.8.0"]]

 :nrepl        {:port 3333}

 :builds
 {:app {:target :browser
        :output-dir "public/js"
        :asset-path "/js"

        :modules
        {:main
         {:entries [giggin.core]}}

        :devtools
        {:after-load  giggin.core/main
         :http-root   "public"
         :http-port   3000}}}}

roelof12:01:36

that one is open

thheller12:01:46

what does the browser console say?

zimablue12:01:57

@thheller, I see - I think this problem might be separate, since the chai importation is direct in this file not through datascript. What should that import look like and do you have any idea how I nudge typescript to compile it so that it requires correctly?

thheller12:01:26

well there isn't really any way to do this

thheller12:01:52

since the datascript npm package is bundled differently and not by shadow-cljs

thheller12:01:51

yeah I really don't think the way you are trying this is going to work

zimablue12:01:39

I see, thanks for all your help I learned something hopefully

zimablue12:01:57

is a better approach to try and bundle the javascript into an npm package shape, whatever that is

zimablue12:01:04

since shadow-cljs knows how to consume that?

thheller12:01:35

no that won't do anything

thheller12:01:13

the issue is getting JS->CLJS->JS->JS working

zimablue12:01:51

that's not strictly necessary, I'm only trying to test some isolated pieces, I don't need to go datascript=>js=>datascript, I just commented those parts. I also rearranged to check and all the inter-project direct imports work, it's just anything that assumes it's going to see a node_modules and does like that unqualified import like var ramda = require("ramda")

zimablue12:01:21

so if I can just go datascript => js => (assumed node_modules import) I will have enough to do the poking that I was hoping for

zimablue12:01:47

thanks so much, do you have any simple menial task I could do as compensation for your help?

zimablue12:01:55

(help so far)

zendevil.eth12:01:31

I get a warning in my react-native app: the shadow-cljs websocket was disconnected.

zendevil.eth12:01:43

Do you know what’s the cause?

thheller12:01:50

no. did it ever connect successfully?

zendevil.eth15:01:36

i don’t know what the websocket is

zendevil.eth16:01:09

it seems like it’s connected successfully since the app correctly loads.

thheller17:01:24

no that doesn't mean anything. the websocket is injected by shadow-cljs to provide the hot-reload and REPL. it does not effect the app loading part.

thheller17:01:42

but it may fail to connect if it picked the wrong IP or so

thheller17:01:47

but without more info I cannot help you

zendevil.eth05:01:35

I’m not exactly sure what info to provide

roelof12:01:55

I see two messages

Warning: The tag <orders> is unrecognized in this browser. If you meant to render a React component, start its name with an uppercase letter.

CLJS DevTools: some custom formatters were not rendered.

roelof12:01:14

I see the posted message on repl of VS Code

roelof12:01:45

I want to show the contents of this :

(ns giggin.state
  (:require [reagent.core :as r]))

(def orders (r/atom {}))

thheller12:01:22

@roelof this ; No available JS runtime. means that the browser has not connected back to shadow-cljs. that is the only issue you need to solve. the code does not matter. I cannot solve this for you without more info. the build config you provided will have generated a public/js/main.js. I assume you have a public/index.html file with a <script src="/js/main.js">?

roelof12:01:03

and I tried also (js/alert "test") and then I saw a popup so it seems there is a js runtime

thheller12:01:15

and you don't get a shadow-cljs ready message in the browser console?

thheller12:01:25

wait now there is a runtime?

roelof12:01:45

if I do the alert there seems to be a runtime

thheller12:01:20

and what do you get via giggin.state/order?

roelof12:01:26

yes, I see this message : `shadow-cljs: #7 ready!`

thheller12:01:33

ok. that is your runtime

thheller12:01:48

did you try the REPL stuff before opening the page?

roelof12:01:08

then it seems to work

roelof12:01:15

`cljs꞉cljs.user꞉> giggin.state/orders #<Atom: {}>`

roelof12:01:54

yep, then everything works then

crankyadmin14:01:24

Hi, this may be a question for graal js but thought I'd give it a go. Has anyone managed to get shadow-cljs to output js that can be loaded via graal context?

crankyadmin14:01:55

Currently I'm playing with :target :esm which has got me further than I have been...

thheller14:01:20

there is an undocument :target :graaljs which sort of works for most stuff

crankyadmin14:01:33

Cheers, I'll give that a blast and have a look at the source.

thheller14:01:23

just :entries [whatever.ns] :output-to "foo/bar.js"

thheller14:01:39

it has no support for running graaljs context or so. that you have to do yourself.

3
thheller14:01:28

no REPL or hot-reload either since the default context doesn't support it. I can show some code to sort of get it but its pretty specific to how you create and use the graal context

crankyadmin14:01:29

If you have some example code it would be great. I'm currently going off nothing so anything is helpful.

thheller14:01:02

well what do you intend to do with graal?

crankyadmin14:01:06

Using it for ssr a reagent app.

crankyadmin14:01:13

I started using shadow a couple of years back because of the great npm support but now have to get that app ssr'ing, graal because of the performance uplift.

thheller14:01:40

performance is generally a lot worse than node

thheller14:01:43

startup time is horrible

thheller14:01:37

and no support for async whatsoever is rather limiting

thheller14:01:25

they have since moved to shadow-cljs and I implemented the :target :graaljs for them as well as some custom code so they get some hot-reload

crankyadmin14:01:21

Looks like it would be wise to go back to ol' fashioned jvm

GGfpc19:01:53

How can I start a repl that I can tap into with (shadow/repl) but without reloading the server on every change?

GGfpc19:01:26

I want to write some code in the repl but don't want to lose state on every change

Malik Kennedy17:01:44

def's get re-evaluated and overwritten, running shadow-cljs watch , if I have state that I don't want to get re-initialized and re at the def form, there's defonce .

GGfpc19:01:03

I tried the browser repl but I can't connect via Cursive because it returns this error

(shadow/repl :app)
Execution error (ExceptionInfo) at shadow.cljs.devtools.server.nrepl-impl/repl-init (nrepl_impl.clj:28).
watch for build not running

Robert Mitchell19:01:43

“watch for build not running”. Have you tried (shadow/watch :app) first?

thheller19:01:16

> ... but don't want to lose state on every change

thheller19:01:16

that is your code losing the state. you can fix that. you can also run (shadow/watch :app {:autobuild false}) so it doesn't automatically recompile if thats what you are asking

thheller19:01:36

also just (shadow/node-repl) is usually good enough if you just want a repl