Fork me on GitHub
#shadow-cljs
<
2023-09-17
>
skynet15:09:28

hey think I might've found a bug with #inst in cljs. given: deps.edn :

{:aliases
 {:cljs
  {:deps {thheller/shadow-cljs {:mvn/version "2.25.5"}}
   :main-opts ["-m" "shadow.cljs.devtools.cli"]}}}
shadow-cljs.edn :
{:deps {:aliases [:cljs]}
 :builds
 {:web
  {:target :browser
   :modules {:main {:entries [main]
                    :init-fn main/init}}}}} 
src/main.cljs :
(ns main)

(defn init []
  (println #inst "2023-09-17T00:00:00Z"))
then run
$ clj -M:cljs release web
[:web] Compiling ...
Failed writing cache for main: java.lang.Exception: Not supported: class java.time.Instant
[:web] Build completed. (45 files, 1 compiled, 0 warnings, 4.13s)
the dev compiler runs fine (with clj -M:cljs watch web), and the generated code seems to work no problem so I guess it's some issue with caching only?

thheller16:09:53

#inst does not usually create a java.time.Instant. guess you have some extra dependencies somewhere that has a data_readers.clj file?

thheller16:09:25

but yes, it only fails the cache. compilation was fine.

skynet16:09:18

it fails even when using :replace-deps for the alias, I think it's something that shadow-cljs itself requires

thheller16:09:40

do a clj -A:cljs -Stree

thheller16:09:13

I get the expected java.util.Date when I use #inst

thheller16:09:58

or do a clj -M:cljs clj-repl then ( "data_readers.cljc") or ( "data_readers.clj")

thheller16:09:04

or better yet don't use data readers at all. they suck in code 😛

👍 1
skynet16:09:14

$ clj -A:cljs -Stree
WARNING: Use of :main-opts with -A is deprecated. Use -M instead.
org.clojure/clojure 1.11.1
  . org.clojure/spec.alpha 0.3.218
  . org.clojure/core.specs.alpha 0.2.62
thheller/shadow-cljs 2.25.5
  . org.clojure/data.json 2.4.0
  . org.clojure/tools.cli 1.0.206
  . org.clojure/tools.reader 1.3.6
  . nrepl/nrepl 1.0.0
  . cider/piggieback 0.5.3
  . com.cognitect/transit-clj 1.0.329
    . com.cognitect/transit-java 1.0.362
      . com.fasterxml.jackson.core/jackson-core 2.8.7
      . org.msgpack/msgpack 0.6.12
        . com.googlecode.json-simple/json-simple 1.1.1
        . org.javassist/javassist 3.18.1-GA
      . javax.xml.bind/jaxb-api 2.3.0
  . com.cognitect/transit-cljs 0.8.280
    . com.cognitect/transit-js 0.8.874
  . org.clojure/core.async 1.5.648
    . org.clojure/tools.analyzer.jvm 1.2.2
      . org.clojure/tools.analyzer 1.1.0
      . org.clojure/core.memoize 1.0.253
        . org.clojure/core.cache 1.0.225
          . org.clojure/data.priority-map 1.1.0
      . org.ow2.asm/asm 9.2
      . org.clojure/tools.reader 1.3.6
  . org.clojure/clojurescript 1.11.60
    . org.clojure/tools.reader 1.3.6
    . com.cognitect/transit-java 1.0.362
  . com.google.javascript/closure-compiler-unshaded v20230411
    . args4j/args4j 2.33
    . com.google.auto.value/auto-value-annotations 1.6
    . com.google.code.gson/gson 2.9.1
    . com.google.errorprone/error_prone_annotations 2.15.0
    . com.google.guava/failureaccess 1.0.1
    . com.google.guava/guava 31.0.1-jre
      . com.google.guava/failureaccess 1.0.1
      . com.google.guava/listenablefuture 9999.0-empty-to-avoid-conflict-with-guava
      . com.google.code.findbugs/jsr305 3.0.2
      . org.checkerframework/checker-qual 3.12.0
      X com.google.errorprone/error_prone_annotations 2.7.1 :older-version
      . com.google.j2objc/j2objc-annotations 1.3
    . com.google.protobuf/protobuf-java 3.21.12
    . com.google.re2j/re2j 1.3
    . javax.annotation/jsr250-api 1.0
    . org.apache.ant/ant 1.10.11
      . org.apache.ant/ant-launcher 1.10.11
    . org.jspecify/jspecify 0.2.0
  . org.clojure/google-closure-library 0.0-20230227-c7c0a541
    . org.clojure/google-closure-library-third-party 0.0-20230227-c7c0a541
  . org.clojure/google-closure-library-third-party 0.0-20230227-c7c0a541
  . thheller/shadow-util 0.7.0
    . hiccup/hiccup 1.0.5
  . thheller/shadow-client 1.3.3
    X org.clojure/core.async 0.3.443 :older-version
    . hiccup/hiccup 1.0.5
  . thheller/shadow-undertow 0.3.1
    . org.clojure/core.async 1.5.648
    . io.undertow/undertow-core 2.2.4.Final
      . org.jboss.logging/jboss-logging 3.4.1.Final
      . org.jboss.xnio/xnio-api 3.8.0.Final
        . org.wildfly.common/wildfly-common 1.5.2.Final
        . org.wildfly.client/wildfly-client-config 1.0.1.Final
          X org.jboss.logging/jboss-logging 3.3.1.Final :older-version
          X org.wildfly.common/wildfly-common 1.2.0.Final :older-version
      . org.jboss.xnio/xnio-nio 3.8.0.Final
        . org.jboss.xnio/xnio-api 3.8.0.Final
          X org.jboss.threads/jboss-threads 2.3.3.Final :older-version
      . org.jboss.threads/jboss-threads 3.1.0.Final
        . org.jboss.logging/jboss-logging 3.4.1.Final
  . thheller/shadow-cljsjs 0.0.22
  . hiccup/hiccup 1.0.5
  . ring/ring-core 1.9.6
    . ring/ring-codec 1.2.0
    . commons-io/commons-io 2.11.0
    . commons-fileupload/commons-fileupload 1.4
      X commons-io/commons-io 2.2 :older-version
    . crypto-random/crypto-random 1.2.1
      . commons-codec/commons-codec 1.15
    . crypto-equality/crypto-equality 1.0.1
  . io.methvin/directory-watcher 0.17.1
    . net.java.dev.jna/jna 5.12.1
    . org.slf4j/slf4j-api 1.7.36
  . expound/expound 0.9.0
  . fipp/fipp 0.6.26
    . org.clojure/core.rrb-vector 0.1.2
  . com.bhauman/cljs-test-display 0.1.1

skynet16:09:47

$ clj -M:cljs clj-repl
shadow-cljs - server version: 2.25.5 running at 
shadow-cljs - nREPL server started on port 33655
shadow-cljs - REPL - see (help)
To quit, type: :repl/quit
( "data_readers.cljc")
nil
( "data_readers.clj")
nil

skynet16:09:57

> or better yet don't use data readers at all I think you're right about this! will probably switch off them in this case

thheller17:09:52

it is a built-in. I just don't know why you get a java.time.Instant, since that is not the default built-in you are supposed to get

thheller17:09:12

but yeah I data readers in code are nothing but trouble. perfectly great in data, just not in source code

👍 1