Fork me on GitHub
#shadow-cljs
<
2023-07-03
>
Schpaa10:07:39

Does this make sense to anyone?

clojure -M:shadow-cljs watch :app                                                                                                            (git)-[main]- 0 chris:~$
Execution error (AssertionError) at shadow.undertow/eval19650$fn (undertow.clj:163).
Assert failed: (.exists root-dir)

hifumi12311:07:33

Looks like you're invoking shadow-cljs incorrectly. When using Clojure CLI you need to run shadow.cljs.devtools.cli watch app

thheller11:07:36

folder that doesn't exist. :dev-http config probably?

thheller11:07:14

@hifumi123 thats what the -M:shadow-cljs alias likely does

Schpaa11:07:27

Im using deps

hifumi12311:07:31

@thheller ah I didn't realize -M was an alias, I thought only -A was an alias

Schpaa11:07:56

I think it is related to npm somehow

Schpaa11:07:19

npm also does not work properly

thheller11:07:06

open your shadow-cljs.edn. look for configured paths. there might be :dev-http? the assert is shit, so its not really helping but its just telling you that a directory it expected doesn't exist

thheller11:07:36

what doesn't work about npm? could just be your filesystem being wonky for some reason. are you running in some kind of docker or so container?

Schpaa11:07:12

{:deps           {:aliases [:shadow-cljs]}
 :nrepl          {:port 10000}
 :dev-http       {10001 ["/Volumes/RAMDisk/dumdom1" "classpath:public"]
                  10002 "out/test"}
 :builds
 {:app {:target :browser
        :output-dir "/Volumes/RAMDisk/dumdom1/js"
        :modules {:main {:init-fn }}
        :release {:output-dir "dist/js"
                  :compiler-options {:infer-externs :auto
                                     :optimizations :advanced}}}}}

Schpaa11:07:41

no docker, just firebase-tools

thheller11:07:50

"/Volumes/RAMDisk/dumdom1" that is likely it

thheller11:07:15

under normal circumstances it will try to created this directory if it doesn't exist. but that seems to fail

Schpaa11:07:44

I forgot to mount it after a reboot, thanks for the insight!

thheller12:07:10

FWIW you don't need those :compiler-options. those are the defaults, no need to repeat them

👍 2
diego.videco17:07:06

Hello everyone. I have a case of google closure mangling the keys of an object. There is a JS file in my path /src/js/my-fork.js, which is a fork from another library. There, there is an object that looks like this:

const myObj = {
    target: null, // will be a dom element
    add(target, options) {
        this.target = target;
        if (target) {
            let defaultOptions = {
                key1:1,
                key2:2,
            };
            // ...
            target.options = {...defaultOptions, options}
        }
    }
}
The add method is called from the CLJS side, but the defaultOptions keys are mangled in the advanced build. So the passed in options are ignored because the keys do not correspond to the mangled keys. I am not entirely sure how to deal with this case in an elegant way. EDIT: Just added the keys to an externs/my-build.txt file, and it worked. Is that the best way?

thheller18:07:53

yes, there is no externs inference for JS files. so this gets renamed without externs.

thheller18:07:03

or an easier option is to just use string keys

thheller18:07:42

or not include this via the classpath JS option, by putting it into node_modules/your-thing and include it like a regular JS lib

diego.videco18:07:31

I see, thanks.