This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-03-05
Channels
- # announcements (17)
- # aws (1)
- # babashka (68)
- # beginners (88)
- # calva (85)
- # chlorine-clover (10)
- # cider (5)
- # cljsrn (4)
- # clojure (99)
- # clojure-android (1)
- # clojure-denmark (1)
- # clojure-europe (15)
- # clojure-italy (5)
- # clojure-nl (3)
- # clojure-spec (1)
- # clojure-uk (67)
- # clojurescript (44)
- # core-async (44)
- # cryogen (4)
- # cursive (22)
- # data-science (2)
- # datascript (10)
- # datomic (29)
- # duct (11)
- # editors (2)
- # emacs (2)
- # events (1)
- # fulcro (28)
- # ghostwheel (7)
- # graalvm (8)
- # instaparse (6)
- # java (34)
- # jobs (9)
- # jobs-discuss (71)
- # juxt (12)
- # luminus (3)
- # malli (15)
- # meander (9)
- # nrepl (4)
- # off-topic (44)
- # pathom (13)
- # reagent (22)
- # schema (1)
- # shadow-cljs (39)
- # spacemacs (2)
- # test-check (1)
- # tree-sitter (5)
- # xtdb (5)
- # yada (1)
I’m using https://github.com/juxt/tick in a :react-native
target and the app will crash when running as a production build: shadow-cljs release app
there is some information related to this library and shadow-cljs
: https://github.com/henryw374/tick-on-shadow-cljs-demo that does not help with production builds. However, using shadow-cljs compile app
before ./gradlew assembleRelease
to skip optimisations will result in a working app. Any hints? I read the excellent documentation to shadow-cljs but seem to have missed something. Thanks in advance!
Couple of things you can try in :compiler-options
: :optimizations :simple
and :infer-externs :auto
I have :compiler-options {:infer-externs :auto}
but there is no hint to what I could change to make thinks work. As a workaround :optimizations :simple
probably works but having :advanced
compilation working is preferred.
tick
depends on js-joda-time
which is normally pulled in with cljsjs
based deps… so my guess is, that js-joda.time*
gets yanked by the compiler because they are not considered as used. Just an idea…
The device log shows the crash as:
--------- beginning of crash
2020-03-05 16:39:19.966 1894-1923/? E/AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
Process: , PID: 1894
com.facebook.react.common.JavascriptException: TypeError: this.wh is not a function. (In 'this.wh()', 'this.wh' is undefined), stack:
nh@409:439247
might just be missing externs in the tick library since :infer-externs :auto
only warns about your sources
one quick way to find out what that originally was is running shadow-cljs release app --pseudo-names
and looking at the log
Cool, thanks @U05224H0W will try later, when back at the keyboard...
Tried shadow-cljs release app --pseudo-names
and only got one warning:
------ WARNING #1 - -----------------------------------------------------------
Resource: com/cognitect/transit/impl/writer.js:256:8
variable isObject is undeclared
--------------------------------------------------------------------------------
nil
but nothing like “`this.$someThing$` is undefined”However running shadow-cljs check app
gives me tons of warnings (> 500) many related to the tick library:
------ WARNING #547 - ---------------------------------------------------------
File: ~/.m2/repository/tick/tick/0.4.23-alpha/tick-0.4.23-alpha.jar!/tick/core.cljc:1055:61
--------------------------------------------------------------------------------
1052 | LocalDateTime
1053 | (in [ldt z] (.atZone ldt z))
1054 | (offset-by [ldt offset] #?(:clj (.atOffset ldt (zone-offset offset))
1055 | :cljs (.atZone ldt (zone-offset offset))))
-------------------------------------------------------------------^------------
Property atZone never defined on ldt__$1
--------------------------------------------------------------------------------
--------- beginning of crash
2020-03-05 16:39:19.966 1894-1923/? E/AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
Process: , PID: 1894
com.facebook.react.common.JavascriptException: TypeError: this.wh is not a function. (In 'this.wh()', 'this.wh' is undefined), stack:
nh@409:439247
Here we go, found the missing externs in the device log:
E/ReactNativeJS: TypeError: this.$toLocalDate$ is not a function. (In 'this.$toLocalDate$()', 'this.$toLocalDate$' is undefined)
… put it in externs/app.txt
, rebuild the apk and now it no longer crashes. Thank you very much Sir!Regarding tick’s “externs it has by default”, where would I find those? Didn’t find them in the repo?
:compiler-options {:externs ["cljsjs/js-joda/common/js-joda.ext.js"]}
in your build config
So I guess adding thheller/shadow-cljsjs
as a dependency would have fixed the problem as well?
Morning. Has anyone ever managed to resolve npm dependencies installed by shadow-cljs in cursive? Cursive always displays these as “x cannot be resolved”. This because the npm dependencies are in package.json but not project.clj - Cursive seems to only scan those in project.clj. Thoughts?
@U0567Q30W is there a github ticket for that yet?