Fork me on GitHub
#shadow-cljs
<
2021-06-05
>
awb9901:06:18

I have a weird bug with shadow-cljs: when I add the dependency to tools.deps.alpha, add-libs3 branch, the watch comand crashes.

awb9901:06:22

this is the dependency: org.clojure/tools.deps.alpha {:git/url "https://github.com/clojure/tools.deps.alpha.git" :sha "241cd24c35ba770aea4773ea161d45276e5d3a73"

awb9901:06:28

And this the error:

awb9901:06:01

[2021-06-05 01:46:51.392 - WARNING] :shadow.cljs.devtools.server.util/handle-ex - {:msg {:type :start-autobuild}} NoSuchMethodError 'java.util.stream.Collector com.google.common.collect.ImmutableList.toImmutableList()' com.google.javascript.jscomp.deps.DependencyInfo$Require.asSymbolList (DependencyInfo.java:60) com.google.javascript.jscomp.deps.DependencyInfo$Base.getRequiredSymbols (DependencyInfo.java:163) com.google.javascript.jscomp.Compiler.findModulesFromInput (Compiler.java:1954) com.google.javascript.jscomp.Compiler.findModulesFromEntryPoints (Compiler.java:1910) com.google.javascript.jscomp.Compiler.parseInputs (Compiler.java:1723) com.google.javascript.jscomp.Compiler.parseForCompilationInternal (Compiler.java:933) com.google.javascript.jscomp.Compiler.lambda$parseForCompilation$4 (Compiler.java:916) com.google.javascript.jscomp.CompilerExecutor.runInCompilerThread (CompilerExecutor.java:127) com.google.javascript.jscomp.Compiler.runInCompilerThread (Compiler.java:816) com.google.javascript.jscomp.Compiler.parseForCompilation (Compiler.java:914) com.google.javascript.jscomp.Compiler.compile (Compiler.java:667) jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (:-2)

awb9901:06:17

my setup is completely the same.

awb9901:06:27

just adding the dependency is enough

thheller06:06:19

dependency conflict on guava

awb9917:06:55

how can there be dependency conflicts with deps.alpha ? deps.alpha always takes the newest version?

awb9917:06:05

any idea how to resolve it?

thheller17:06:48

the newest version may be the one breaking stuff

thheller17:06:25

you'll need the version the closure compiler expects

thheller17:06:08

no clue why you are putting tools.deps.alpha on the classpath for CLJS compilation though, probably best to keep it in a server-only alias

SxP02:06:04

What's the proper way to use printf formatting in Clojurescript? I see posts on the web suggesting using goog.string.format but there are other posts discussing dead code elimination issues with that library. I have a minimal test app with

(ns stopwatch (:require [goog.string :as gs]))
(println (gs/format "Hello %s" "world"))
that works with shadow-cljs when building without optimizations. But if I use :simple or :advanced, I get a runtime failure because goog.string is missing format.

thheller06:06:24

@sameer864 add an extra [goog.string.format] to your :require then it'll work. it lives in its own file/namespace so just importing goog.string is not enough

thheller06:06:19

(for dev builds likely some other devtool requires it, so it works accidentally. for release builds that devtool is unused and so the require is missing)

SxP07:06:37

@thheller, thanks. That worked. Is this an issue specific to goog.string/format or will I run into this with other APIs when I create release builds? I though the build system would automatically include all the transitive dependencies of the functions I refer to.

thheller07:06:20

not the functions you refer to. the namespaces you require. goog.string.format just happens to be this special case that it is a separate namespace, not part of goog.string.

👍 3
thheller07:06:23

its a weird case, that is rather uncommon

sb16:06:10

Somebody solved this npm package w/shadow-cljs? https://www.npmjs.com/package/react-dates, I require as

["react-dates/initialize" :as init]
["react-dates" :as rd :refer [DateRangePicker SingleDatePicker DayPickerRangeController]]

sb16:06:01

I tried with `

(def DateRangePickerX
  (r/adapt-react-class DateRangePicker))
or [:> DateRangePicker.. but not really work..

sb16:06:24

any idea what.. I did in wrong way?

thheller17:06:05

@sb and what is the error?

sb17:06:15

simply no error..

sb17:06:25

nothing happens.. when I click on the fields..

thheller17:06:57

probably because you are missing the css?

thheller17:06:05

at least looks like that?

sb17:06:17

without css.. I didn’t add, I just check the functionality

sb17:06:23

yes, without css

thheller17:06:36

don't know what it does but it might happen outside the visual area because of the missing css

sb17:06:54

ok, I’m going to add it, thanks!

sb17:06:02

I don’t think…

body {
  margin: 0;
  padding: 0;
  font-family: sans-serif;
}

sb17:06:05

that is the css

thheller17:06:18

that is the css?

sb17:06:27

Sorry, true!

sb17:06:06

I need to setup a demo project for this.. because without this I can’t debug.. 😕

thheller17:06:09

probably a better question for #reagent the shadow-cljs parts seem to work fine