Fork me on GitHub
#shadow-cljs
<
2021-10-27
>
thheller07:10:36

@diego.vid.eco I can't reproduce that problem? which OS is this? I'm on windows 10 and its working fine? supposedly you can increase the max filename length on windows? https://helpdeskgeek.com/how-to/how-to-fix-filename-is-too-long-issue-in-windows/

diego.videco18:10:21

I am on Linux Mint, I guess it may be possible

diego.videco18:10:14

Didn't try it as I wouldn't want to risk having problems when building somewhere else. In the end I opted for another library.

thheller07:10:43

(I have not done this but maybe fixes your issue?)

pmooser08:10:18

I have a question about the output of the :node-script option. I used it successfully, but in the mode that I had built things, the node script that was output still had some dependencies back into the build directory. Is that expected, or a characteristic somehow of the build that I specified? Do you know offhand?

pmooser08:10:44

(I mean like SHADOW-IMPORT-PATH sorts of things)

pmooser08:10:48

Ok maybe this is just the difference between doing a compile vs release in this case.

thheller08:10:50

@pmooser yes, compile is only meant to run in the place where it is created. release you can move around. it'll still require access to the npm modules you used though

pmooser09:10:28

Ah, interesting. So I guess that means ... you can't really move the result between machines unless your npms are installed globally (and presumably the versions match etc) ?

thheller09:10:58

no not at all

thheller09:10:11

just need to consider how you move things arround

thheller09:10:50

if you want something that is completely self contained you can post process the output with something like https://github.com/vercel/ncc

thheller09:10:16

if you make it a npm package you just include a package.json and that'll take care of installing the dependencies for you

thheller09:10:36

and no never install any npm packages globally

thheller09:10:58

its pretty much the same in clojure with using a jar vs uberjar, if that means anything to you

thheller09:10:15

jar won't run without dependencies, uberjar will

thheller09:10:35

uberjar = post processed with ncc

pmooser09:10:40

Hmm, thanks very much for that link. I don't understand quite enough about npm to understand (yet) how to do it myself but that project looks like it might be the perfect thing. What I was experimenting with was using the node-script capability to be able to make some scripts that can do some batch processing on data that our app uses, but without involvement of our normal client/server ...

pmooser09:10:48

It's really a very nice capability!

pmooser09:10:57

Yeah, I understand jar vs uberjar.

pmooser09:10:03

One more (stupid) question - is it feasible to just install the npms myself in the directory where I run the script, as opposed to using a packaging utility like the one you linked?

pmooser09:10:29

Although the thing you linked looks very easy to use.

thheller09:10:06

create a directory. put a package.json into it. put the :node-script output into it. copy that directory to wherever, run npm install then you can run your script just fine

thheller09:10:38

just declare the runtime dependencies of your script in the package.json and npm install will install them

pmooser09:10:12

Ok - thanks thheller!

Mateusz Mazurczak13:10:35

Hi! I get an error after I updated libraries (it was a long time since they were updated)

Execution error (FileNotFoundException) at clojure.main/main (main.java:40). Could not locate shadow/cljs/devtools/cli__init.class, shadow/cljs/devtools/cli.clj or shadow/cljs/devtools/cli.cljc on classpath.                                                           
I have thheller/shadow-cljs in my deps.edn. The version in deps.edn and in yarn.lock is the same.
thheller/shadow-cljs {:mvn/version "2.15.12"}
Any ideas?

thheller13:10:45

is deps.edn formatted correctly?

thheller13:10:57

sometimes things slip into other maps and such

Mateusz Mazurczak13:10:11

Yeap, no errors in intellij

thheller13:10:11

{:deps {some/thing {:mvn/version "1.2.3
            thheller/shadow-cljs {:mvn/version "4.5.6"}}}

thheller13:10:57

that would give no error but still be incorrect

Mateusz Mazurczak13:10:00

{:aliases
 {
  ;; start a modern nREPL server on port 4000:
  :nrepl {:extra-deps {nrepl/nrepl {:mvn/version "0.8.3"}}
          :main-opts ["-m" "nrepl.cmdline"
                      "--bind" "0.0.0.0"
                      "--port" "4000"]
          :jvm-opts ["-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=0.0.0.0:5010"]}

  :cljs {:extra-deps {thheller/shadow-cljs {:mvn/version "2.15.12"}
                      com.cognitect/transit-cljs {:mvn/version "0.8.256"}
                      reagent/reagent {:mvn/version "1.1.0"
                                       :exclusions [cljsjs/react cljsjs/react-dom]}
                      secretary/secretary {:mvn/version "1.2.3"}
                      hiccups/hiccups {:mvn/version "0.3.0"
                                       :exclusions [cljsjs/react cljsjs/react-dom]}
                      cljs-http/cljs-http {:mvn/version "0.1.45"}
                      bidi/bidi {:mvn/version "2.1.6"}
                      noencore/noencore {:mvn/version "0.3.4"}
                      medley/medley {:mvn/version "1.2.0"}
                      reagent-utils/reagent-utils {:mvn/version "0.3.4"
                                                   :exclusions [cljsjs/react cljsjs/react-dom]}
                      com.andrewmcveigh/cljs-time {:mvn/version "0.5.2"}
                      org.clojure/core.match {:mvn/version "0.3.0-alpha5"}
                      garden/garden {:mvn/version "1.3.6"}
                      alandipert/storage-atom {:mvn/version "2.0.1"}
                      frankiesardo/linked {:mvn/version "1.3.0"}
                      markdown-clj/markdown-clj {:mvn/version "1.0.7"}

                      ;; [Devtools]()
                      ;; adds custom formatters support for ClojureScript to
                      ;; Chrome, so that ClojureScript data can be
                      ;; comfortably inspected in the Chrome Dev Tools
                      ;; Console. Shadow-CLJS automatically activates
                      ;; cljs-devtools for every dev build, when it is on
                      ;; the classpath, see:
                      binaryage/devtools {:mvn/version "0.9.10"}

                      cider/cider-nrepl {:mvn/version "0.26.0"}
                      }
         :extra-paths ["src/cljs"]}

  :pack {:extra-deps
         {pack/pack.alpha
          {:git/url ""
           :sha "511c32d4238afb860ad0b16c4827322d80c7d615"
           :exclusions [org.slf4j/slf4j-nop]}}
         :main-opts
         ["-m"]}
  }

 :jvm-opts [
            ;; added to prevent exceptions with no stacktraces, see:
            ;; 
            "-XX:-OmitStackTraceInFastThrow"
            ]

 :paths ["src/clj" "src/cljc" "src/cljs" "resources" "classes"]

 :mvn/repos {"" {:url ""}
             "central" {:url ""}
             "clojars" {:url ""}}

 :deps {org.clojure/clojure {:mvn/version "1.10.3"}
        org.clojure/core.cache {:mvn/version "1.0.217"}
        org.clojure/core.memoize {:mvn/version "1.0.250"}
        org.clojure/core.async {:mvn/version "1.3.622"}
        org.clojure/core.match {:mvn/version "1.0.0"}
        com.cognitect/transit-clj {:mvn/version "1.0.324"}
        com.cognitect/anomalies {:mvn/version "0.1.12"}

        nrepl/nrepl {:mvn/version "0.8.3"}

        expound/expound {:mvn/version "0.8.10"}
        ring/ring-core {:mvn/version "1.9.4"}
        ring/ring-servlet {:mvn/version "1.9.4"}
        ring/ring-ssl {:mvn/version "0.3.0"}
        javax.servlet/servlet-api {:mvn/version "2.5"}
        clj-time/clj-time {:mvn/version "0.15.2"}
        org.clojure/tools.namespace {:mvn/version "1.1.0"}
        medley/medley {:mvn/version "1.3.0"}
        io.sentry/sentry-clj {:mvn/version "5.2.158"}
        ring-middleware-format/ring-middleware-format {:mvn/version "0.7.4"}
        ring-partial-content/ring-partial-content {:mvn/version "2.0.1"}
        ring-cors/ring-cors {:mvn/version "0.1.13"}
        bk/ring-gzip {:mvn/version "0.3.0"}
        cheshire/cheshire {:mvn/version "5.10.1"}
        org.shredzone.acme4j/acme4j-client {:mvn/version "2.12"}
        org.shredzone.acme4j/acme4j-utils {:mvn/version "2.12"}
        noencore/noencore {:mvn/version "0.3.6"}
        environ/environ {:mvn/version "1.2.0"}
        sv/blob-storage {:mvn/version "0.1.0"}
        sv.blob-storage/file-blob-storage {:mvn/version "0.1.0"}
        sv.blob-storage/gcloud-storage {:mvn/version "0.1.2"}
        com.draines/postal {:mvn/version "2.0.4"}
        hiccup/hiccup {:mvn/version "1.0.5"}
        buddy/buddy-auth {:mvn/version "3.0.1"}
        me.raynes/fs {:mvn/version "1.4.6"}
        digest/digest {:mvn/version "1.4.10"}
        markdown-clj/markdown-clj {:mvn/version "1.10.6"}
        clj-http/clj-http {:mvn/version "3.12.3"}

        sv/system.core {:mvn/version "0.1.1"}
        sv/system.datomic {:mvn/version "0.1.0"
                           :exclusions [org.slf4j/log4j-over-slf4j
                                        com.datomic/datomic-free]}
        sv/system.main {:mvn/version "0.1.0"}
        sv/system.httpkit {:mvn/version "0.1.0"}

        ;; it is important to use a recent version of
        ;; http-kit since the older version 2.1.18 caused a
        ;; downtime of the leader server due to this issue:
        ;; 
        http-kit/http-kit {:mvn/version "2.5.3"}

        sv/system.ring {:mvn/version "0.1.0"}

        ;; logging:
        com.taoensso/timbre {:mvn/version "5.1.2"}
        sv/timbre.gcloud.logging {:mvn/version "0.1.4"}
        com.fzakaria/slf4j-timbre {:mvn/version "0.3.21"}
        org.slf4j/log4j-over-slf4j {:mvn/version "1.7.32"}
        org.slf4j/jul-to-slf4j {:mvn/version "1.7.32"}
        org.slf4j/jcl-over-slf4j {:mvn/version "1.7.32"}

        ;; using a newer version here, since it has a
        ;; better `DefaultCredentialProvider` that also
        ;; resolve the application-default-credentials inside
        ;; a docker container via Google Cloud's metadata
        ;; service ``
        com.google.api-client/google-api-client {:mvn/version "1.32.2"}

        sv/gcloud.client {:mvn/version "0.1.4"}
        com.google.guava/guava {:mvn/version "27.0.1-jre"}
        com.google.cloud/google-cloud-storage {:mvn/version "2.1.9"}
        etaoin/etaoin {:mvn/version "0.4.6"}
        clj-chrome-devtools/clj-chrome-devtools {:mvn/version "20200423"}
        com.datomic/datomic-pro {:mvn/version "0.9.5561"
                                 :exclusions [org.slf4j/log4j-over-slf4j
                                              org.slf4j/slf4j-nop]}

        ;; Datomic production storage backend:
        mysql/mysql-connector-java {:mvn/version "8.0.27"}
        ;; for the development environment:
        org.postgresql/postgresql {:mvn/version "42.3.0"}

        com.google.cloud.sql/mysql-socket-factory {:mvn/version "1.3.4"}

        ;; For  to verify webhook requests:
        com.xk72/paddle-webhook-verifier {:mvn/version "1.0"}

        io.grpc/grpc-core {:mvn/version "1.41.0"}
        org.clojure/data.csv {:mvn/version "1.0.0"}
        com.datomic/client-pro {:mvn/version "1.0.72"}
        com.datomic/client-cloud {:mvn/version "1.0.117"}
        danlentz/clj-uuid {:mvn/version "0.1.9"}
        fipp/fipp {:mvn/version "0.6.24"}
        borkdude/sci {:mvn/version "0.2.7"}
        diehard/diehard {:mvn/version "0.10.4"}

        sv/basis {:local/root "basis"}

        sv/message-emit {:git/url ""
                         :sha "e2ad34537505cd7c9e015d88fc4db1da8a42a06f"
                         :deps/root "message-emit"}

        sv/message-logging {:git/url ""
                            :sha "e2ad34537505cd7c9e015d88fc4db1da8a42a06f"
                            :deps/root "message-logging"}

        sv/memcached-auto-discovery {:git/url ""
                                     :sha "e2ad34537505cd7c9e015d88fc4db1da8a42a06f"
                                     :deps/root "memcached-auto-discovery"}

        sv/registry {:git/url ""
                     :sha "e2ad34537505cd7c9e015d88fc4db1da8a42a06f"
                     :deps/root "registry"}
        sv/peer-sci {:git/url ""
                     :sha "590932368d57d09fb475b946b5214996a9abb23f"
                     :exclusions [sv/slf4j-gke-logging]}
        }
 }

Mateusz Mazurczak13:10:08

Previously it was working and in the PR there is no changes that breaks formatting/typos etc

thheller13:10:25

did you activate the alias?

Mateusz Mazurczak13:10:35

what do you mean?

thheller13:10:53

how did you launch shadow-cljs?

thheller13:10:48

what does that mean?

thheller13:10:22

the error you get means that shadow-cljs is NOT on the classpath

thheller13:10:36

so whatever you launched did NOT add the :cljs :extra-deps

thheller13:10:38

don't know what else to tell you. look at the command you run and see if that properly activates the :cljs alias

thheller13:10:01

when/how do you get the error? everything looks correct so far

Mateusz Mazurczak13:10:53

I get it while running yarn release

thheller13:10:02

what does that run?

Mateusz Mazurczak14:10:38

yarn install --frozen-lockfile && yarn gulp && yarn shadow-cljs release client --source-maps && yarn build-tailwind

Mateusz Mazurczak14:10:09

so I guess this is what you asked for yarn shadow-cljs release client --source-maps

thheller14:10:27

yes. so in shadow-cljs.edn do you have :deps {:aliases [:cljs]}?

Mateusz Mazurczak14:10:11

:deps {:aliases [:cljs]}

thheller14:10:58

so what is the output of yarn shadow-cljs release client

thheller14:10:26

or just run yarn shadow-cljs clj-repl

Mateusz Mazurczak14:10:11

sorry for the delay

thheller14:10:16

and clj -A:cljs -M -m shadow.cljs.devtools.cli clj-repl?

Mateusz Mazurczak14:10:32

dev@build-0:~/app$ clj -A:cljs -M -m shadow.cljs.devtools.cli clj-repl
Execution error (FileNotFoundException) at clojure.main/main (main.java:40).
Could not locate shadow/cljs/devtools/cli__init.class, shadow/cljs/devtools/cli.clj or shadow/cljs/devtools/cli.cljc on classpath.

Karol Wójcik14:10:09

@U0281QDFE1X Stepped upon the same. Remove .cpcache & try clj -Sforce This might happen if you remove $HOME/.m2

martinklepsch14:10:04

I got back around to looking into the Firebase upgrade and we’re still seeing the “could not load” error when using the compat modules

shadow-cljs - failed to load module$node_modules$firebase$compat$auth$dist$index_esm
There is a file node_modules/firebase/compat/auth/dist/index.esm.js and we’re not seeing any errors pointing in that direction in the server logs.

thheller14:10:56

@martinklepsch again: this is NOT the error. this is a warning of the file that failed to load. the error is below or above depending on the shadow-cljs version you use

thheller14:10:14

so tell me the error and I can maybe help you, just this warning is not enough

martinklepsch14:10:42

Ohhhh, duh, I’m so sorry, I assumed “elsewhere” meant outside the context of the browser

thheller14:10:38

no elsewhere in the console

martinklepsch14:10:52

TypeError: (0 , _app._registerComponent) is not a function
    at eval (index-f41a0691.js:11897)
    at Object.shadow$provide.module$node_modules$$firebase$auth$dist$esm2017$index_f41a0691 (index-f41a0691.js:12019)
    at shadow.js.jsRequire (js.js:66)
    at Object.shadow$provide.module$node_modules$$firebase$auth$dist$esm2017$internal (internal.js:556)
    at shadow.js.jsRequire (js.js:66)
    at Object.shadow$provide.module$node_modules$$firebase$auth_compat$dist$index_esm2017 (index.esm2017.js:6)
    at shadow.js.jsRequire (js.js:66)
    at Object.shadow$provide.module$node_modules$firebase$compat$auth$dist$index_esm (index.esm.js:4)
    at Object.shadow.js.jsRequire (js.js:66)
    at Object.shadow.js.require (js.js:113)
This is the error that follows the warning above

martinklepsch14:10:58

Sorry for my misunderstanding

thheller14:10:12

hmm yeah this appears to be a bug in the closure compiler

thheller14:10:26

but we can't currently upgrade without a new cljs release

martinklepsch14:10:54

btw I’ve also tried the approach https://clojurians.slack.com/archives/C6N245JGG/p1635137311018500?thread_ts=1634815794.002200&amp;cid=C6N245JGG (using :babel-preset-config {:targets {"chrome" "80"}})

thheller14:10:27

that doesn't matter. typescript started rewriting some code to use the (0, whatever) trick

martinklepsch14:10:32

(but doesn’t seem to affect this)

thheller14:10:40

but closure doesn't like that and rewrites it in a weird broken way

thheller14:10:17

maybe setting :js-options {:entry-keys ["module" "browser" "main"]} in your build config can fix it

thheller14:10:29

but that requires the package to actually publish non rewritten esm code

thheller14:10:37

maybe it does. not sure

martinklepsch15:10:50

Should "main" correspond to a module/entrypoint in our build or is this to be used as-is?

thheller15:10:01

as is. it only configures which key in package.json shadow-cljs uses when using npm packages

thheller15:10:40

has nothing to do with your own code

👍 1
martinklepsch15:10:40

Ok. then it appears to cause the same error

martinklepsch15:10:04

I know there’s a CLJS release upcoming with a Closure upgrade, could it be worth to give that a try?

thheller15:10:27

not that simple unfortunately

martinklepsch15:10:37

We’re not urgently looking for a solution but thought that maybe it’s nice to give feedback there

martinklepsch15:10:51

Ok, then we’ll just wait a bit 🙂

thheller15:10:55

becuase of many breaking changes in the closure compiler we need to upgrade GCC, CLJS and shadow-cljs at the same time

thheller15:10:34

I'm honestly beginning to regret using the closure compiler so much. it is getting tedious keeping up with their breakage

thheller15:10:50

so I might swap that out for another option at some point

martinklepsch15:10:06

That sounds like a herculean effort to me but you probably have a much clearer picture of what that would look like 🙂

martinklepsch15:10:32

I’ll keep an eye on releases then, thanks for helping me understand what’s going wrong here 🙇

thheller15:10:01

I hope the issue is actually fixed in the newer closure compiler. currently hard to try but they fixed a bunch of problems related to the new TS and indirect calls

👍 1
Felipe Cortez16:10:00

what's the proper way to call a CSS watcher process when starting the shadow server? build hooks kind of work but don't detect changes to CSS files. more generally, what's the best of way of launching an "observer" process along shadow?

thheller16:10:10

I recommend a setup like this https://github.com/jacekschae/shadow-cljs-tailwindcss see the package.json using npm-run-all commands

Felipe Cortez16:10:01

oh yeah, I think I saw a GitHub issue mentioning this! thanks!