Fork me on GitHub
#shadow-cljs
<
2021-09-22
>
Benjamin00:09:20

I think I figured out what the problem was, seems that it was a monorepo on the top level and the package I had to link to was under a packages directory

Michaël Salihi08:09:16

Hi, when releasing an app using eternal-index js-options, I had this warning:

[:app] Compiling ...
------ WARNING #1 -  -----------------------------------------------------------
 Resource: shadow.js.shim.module$react_dom.js:3:34
 variable shadow$bridge is undeclared

thheller08:09:42

hmm did I not add that to the externs? could have sworn I did. which version do you use?

thheller08:09:58

should be fine. open an issue if you can reproduce it. can't check right now

Michaël Salihi09:09:08

OK, I wiil. Thanks

Raymond Ko15:09:03

Has anyone gotten build reports to work recently? I'm trying but it's failing with:

failed to run function: shadow.cljs.build-report/-main
{:tag :shadow.cljs.devtools.cli-actual/clj-run, :main-sym shadow.cljs.build-report/-main}
ExceptionInfo: failed to run function: shadow.cljs.build-report/-main
        shadow.cljs.devtools.cli-actual/do-clj-run (cli_actual.clj:110)
        ...
Caused by:
Hook [0 shadow.cljs.build-report/hook] failed in stage :flush
NoSuchFileException: .shadow-cljs/release-snapshots/my-build/latest/main.js
I am not sure where main.js is coming from...

Raymond Ko15:09:58

Okay, I figure it out. Build reports assumes the output file is named after the thing in :modulesbut if you use :output-to then it gets named something completely different.

Raymond Ko15:09:17

shadow-cljs can't find the output.

thheller16:09:19

build reports currently only support the :browser target

thheller16:09:39

size of node libraries usually isn't an issue

Raymond Ko17:09:18

Thanks, I somehow got it to work by changing output to "main.js". I was using this for AWS Lambda and trying to figure out cold boot time, where size does have a impact.

Raymond Ko15:09:56

Could this be because I am trying to make a :node-library and it is missing :modules {:main {}} ?

Stuart15:09:29

Hi, I'm trying to run shadow-cljs watch app . I'm using WSL on windows via VS Code. This project I'm trying to run works perfectly on my Ubuntu machine. But when I try to run watch app on WSL I'm getting the following error:

[email protected]:/mnt/c/Users/stuarts/Source/___TESTREPOS/__Clojure/tic-tac-toe-re-frame$ shadow-cljs watch app
shadow-cljs - config: /mnt/c/Users/stuarts/Source/___TESTREPOS/__Clojure/tic-tac-toe-re-frame/shadow-cljs.edn
Execution error (NoClassDefFoundError) at java.lang.Class/forName0 (Class.java:-2).
Could not initialize class cognitect.transit__init

Full report at:
/tmp/clojure-11163815081130707132.edn
Any ideas what I'm doing wrong. My shadow-cljs.edn
;; shadow-cljs configuration
{:source-paths
           ["src/dev"
            "src/main"
            "src/test"]

 :dependencies
           [[binaryage/devtools "0.9.10"]
            [reagent "1.0.0"]
            [re-frame "1.2.0"]
            [day8.re-frame/re-frame-10x "1.0.1"]
            [day8.re-frame/http-fx "0.2.3"]
            [bidi "2.1.6"]
            [cljs-ajax "0.8.1"]
            [com.andrewmcveigh/cljs-time "0.5.2"]
            [com.rpl/specter "1.1.3"]]

 :nrepl    {:port 3333}
 :dev-http {8080 "public"}
 :builds   {:app {:target           :browser
                  :output-dir       "public/js"
                  :modules          {:main {:init-fn }}
                  :compiler-options {:closure-defines {re-frame.trace/trace-enabled?        true
                                                       day8.re-frame.tracing/trace-enabled? true}}
                  :devtools {:http-root "public"
                             :http-port 3000
                             :preloads [day8.re-frame-10x.preload]}}}}

Stuart15:09:50

Ive installed node on wsl, it reports its version as

[email protected]:/mnt/c/Users/stuarts/Source/___TESTREPOS/__Clojure/tic-tac-toe-re-frame$ node --version
v16.9.1

Raymond Ko15:09:31

Could it as simple as missing the transit dependency?

[com.cognitect/transit-cljs "0.8.269"]
[com.cognitect/transit-clj "1.0.324"]

Stuart15:09:00

add these to my shadow deps edn?

Raymond Ko15:09:00

What happens if you add the above two lines to :dependencies?

Stuart15:09:06

Added those, saved the file, ran shadow-cljs watch app again and got same error

[email protected]:/mnt/c/Users/stuarts/Source/___TESTREPOS/__Clojure/tic-tac-toe-re-frame$ shadow-cljs watch app
shadow-cljs - config: /mnt/c/Users/stuarts/Source/___TESTREPOS/__Clojure/tic-tac-toe-re-frame/shadow-cljs.edn
WARNING: The com.cognitect/transit-clj dependency in shadow-cljs.edn was ignored. Default version is used and override is not allowed to ensure compatibility.
The versions provided by shadow-cljs can be found here: 
shadow-cljs - updating dependencies
shadow-cljs - dependencies updated
Execution error (NoClassDefFoundError) at java.lang.Class/forName0 (Class.java:-2).
Could not initialize class cognitect.transit__init

Full report at:
/tmp/clojure-10097363797069404351.edn

Stuart15:09:39

it looks like its ignoring the lines I added ?

Raymond Ko15:09:16

Hmm. I don't have any immediately ideas. • Maybe there is some global deps.edn modifying version. • Try npm install shadow-cljs and ./node_modules/bin/shadow-cljs to use latest version • Does moving the project into the Linux FS instead of /mnt/c work?

Stuart15:09:41

THanks anyway for your help, its appreciated 🙂

Raymond Ko15:09:29

Does shadow-cljs classpath show anything wrong?

Stuart15:09:35

it doesnt generate any errors

Raymond Ko16:09:30

The next I would try is to upgrade shadow-cljs. According to the log, you are using version 2.11.22, which seems a bit old compared to current being https://clojars.org/thheller/shadow-cljs/versions/2.15.10

Raymond Ko16:09:38

Like personally I do what said above and use the one from npm install and node_modules to ensure that the tool is version controlled and always up to date when I use npm-check-upgrades

Raymond Ko16:09:56

I would uninstall the global one.

Stuart16:09:20

ah ok, I'll try that

Raymond Ko16:09:08

Something like that yeah. 1. Create a package.json if you don't already have it npm init and put in whatever. 2. npm install --save-dev shadow-cljs 3. ./node_modules/.bin/shadow-cljs watch app

dpsutton15:09:09

what is the error in /tmp/clojure-11163815081130707132.edn?

Stuart15:09:40

I'm afraid I don't know what a lot of that means

Stuart15:09:35

sticking it in a gist, 2 secs

Apple15:09:59

:clojure.error/class java.lang.NoClassDefFoundError,
  :clojure.error/line -2,
  :clojure.error/cause  "Could not initialize class cognitect.transit__init",

Stuart15:09:04

I did npm install and it says its all up-to-date

Stuart15:09:20

[email protected]:/mnt/c/Users/stuarts/Source/___TESTREPOS/__Clojure/tic-tac-toe-re-frame$ npm install

up to date, audited 112 packages in 1s

3 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

thheller18:09:45

@qmstuart I don't know why you'd get that error. can you try setting :aot false in your shadow-cljs.edn config? same level as :source-paths