shadow-cljs

https://github.com/thheller/shadow-cljs | https://github.com/sponsors/thheller | https://www.patreon.com/thheller
awb99 2021-06-05T01:50:18.374Z

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

awb99 2021-06-05T17:20:55.392600Z

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

awb99 2021-06-05T17:21:05.392800Z

any idea how to resolve it?

thheller 2021-06-05T17:22:48.393Z

the newest version may be the one breaking stuff

thheller 2021-06-05T17:23:25.393400Z

you'll need the version the closure compiler expects

thheller 2021-06-05T17:24:08.393600Z

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

awb99 2021-06-05T01:51:22.374100Z

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

awb99 2021-06-05T01:51:28.374400Z

And this the error:

awb99 2021-06-05T01:52:01.374600Z

[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)

awb99 2021-06-05T01:52:17.374800Z

my setup is completely the same.

awb99 2021-06-05T01:52:27.375Z

just adding the dependency is enough

SxP 2021-06-05T02:48:04.377300Z

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.

thheller 2021-06-05T06:32:19.377400Z

dependency conflict on guava

thheller 2021-06-05T06:33:24.378400Z

@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

thheller 2021-06-05T06:48:19.379900Z

(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)

SxP 2021-06-05T07:05:37.381100Z

@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.

thheller 2021-06-05T07:07:20.382200Z

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.

šŸ‘ 1
thheller 2021-06-05T07:08:23.382900Z

its a weird case, that is rather uncommon

sb 2021-06-05T16:45:10.384100Z

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]]

sb 2021-06-05T16:46:01.385Z

I tried with `

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

sb 2021-06-05T16:46:24.385300Z

any idea what.. I did in wrong way?

sb 2021-06-05T16:49:43.385600Z

Clear example: https://github.com/majapw/react-dates-demo/blob/master/src/App.js

thheller 2021-06-05T17:02:05.386400Z

@sb and what is the error?

sb 2021-06-05T17:03:15.386700Z

simply no error..

sb 2021-06-05T17:03:25.387200Z

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

thheller 2021-06-05T17:03:57.387700Z

probably because you are missing the css?

thheller 2021-06-05T17:04:05.388Z

at least looks like that?

sb 2021-06-05T17:04:17.388300Z

without css.. I didnā€™t add, I just check the functionality

sb 2021-06-05T17:04:23.388600Z

yes, without css

thheller 2021-06-05T17:04:36.388900Z

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

sb 2021-06-05T17:04:54.389200Z

ok, Iā€™m going to add it, thanks!

sb 2021-06-05T17:07:02.390300Z

I donā€™t thinkā€¦

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

sb 2021-06-05T17:07:05.390500Z

that is the css

thheller 2021-06-05T17:08:14.390900Z

https://unpkg.com/browse/react-dates@21.8.0/lib/css/_datepicker.css

šŸ‘ 1
thheller 2021-06-05T17:08:18.391400Z

that is the css?

sb 2021-06-05T17:18:27.392100Z

Sorry, true!

sb 2021-06-05T17:36:06.394600Z

I need to setup a demo project for this.. because without this I canā€™t debug.. šŸ˜•

thheller 2021-06-05T17:38:09.395Z

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