This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-05-25
Channels
- # adventofcode (3)
- # aleph (24)
- # architecture (8)
- # beginners (53)
- # boot (34)
- # cider (7)
- # clara (68)
- # cljs-dev (6)
- # cljsrn (3)
- # clojars (10)
- # clojure (71)
- # clojure-germany (2)
- # clojure-italy (10)
- # clojure-nl (25)
- # clojure-serbia (4)
- # clojure-spec (13)
- # clojure-uk (48)
- # clojurescript (31)
- # core-async (62)
- # cursive (13)
- # datomic (4)
- # duct (76)
- # editors (4)
- # fulcro (2)
- # immutant (1)
- # instaparse (1)
- # jobs (1)
- # lein-figwheel (1)
- # mount (1)
- # off-topic (12)
- # onyx (8)
- # re-frame (10)
- # reagent (84)
- # reitit (2)
- # ring (2)
- # shadow-cljs (159)
- # spacemacs (2)
- # specter (17)
- # sql (14)
- # tools-deps (10)
- # yada (15)
@lockdown- you mean in terms of interop? no you just use the this-as
macro https://cljs.github.io/api/cljs.core/this-as
@bravilogy yes. random-uuid
and uuid
There is also a uuid generator for use with generative testing, so you can, for example (s/exercise uuid?)
Am i passing the --compile-opts correctly? clj -m cljs.main --output-to main.js --compile-opts "{:optimizations advanced :infer-externs true}" --compile hello-expo.core
With version 1.10.238 i get a stacktrace,
Exception in thread "main" java.lang.Exception: Could not write JavaScript nil
at cljs.closure$write_js_QMARK_.invokeStatic(closure.clj:1892)
Its ok without that parameter@grahamcarlyle try it like this https://github.com/pesterhazy/see-el-jay-ess/blob/master/scripts/run-test-deps#L15
@lee.justin.m ah I was trying to evaluate it within cider
and it looks like cider
doesn’t know what random-uuid
is. but it works in the actual app / browser
thanks, so i typo'd the advanced
, it should have been the keyword :advanced
. I'm wondering if there is a process people use to resolve problems like this that result in a stacktrace. Do they crank up a debugger and step through to see where things went wrong? I don't think I could have worked out what was wrong just looking at the stacktrace.
For example I translate the command line I got wrong initially above to a deps.edn alias and I now get another stacktrace
{:deps
{org.clojure/clojurescript {:mvn/version "1.10.238"}}
:aliases
{:prod-build {:main-opts ["-m" "cljs.main"
"--output-to" "main.js"
"--compile-opts" "{:optimizations :advanced, :infer-externs true}"
"--compile" "hello-expo.core"]}}}
Exception in thread "main" java.lang.RuntimeException: EOF while reading
at clojure.lang.Util.runtimeException(Util.java:221)
...
this time the full stack trace suggests its the edn for compile-opts. Weirdly if I replace the spaces in compile-opts with commas (which i believe are treated as whitespace) then it works again, which suggests the edn parser is being passed a string split on spaces? "--compile-opts" "{:optimizations,:advanced,,:infer-externs,true}"
isn't there a way to supply the compile opts as data instead of a string?
i think you can specify a file which contains the EDN
-co, --compile-opts edn Options to configure the build, can be an EDN
string or system-dependent path-separated list of
EDN files / classpath resources. Options will be
merged left to right.
I think that's the best option then
It might be worth checking if there's a JIRA for the issue with compile-opts
containing spaces
Sounds like something somewhere is trying to parse that string as shell arguments
I couldn't find an issue in JIRA that matched this but that may be more due to my unfamiliarity with JIRA
@grahamcarlyle if you can reduce it to a minimal repro, consider filing a ticket
@grahamcarlyle can repro. Curiously it works from the cli clj -m cljs.main --compile-opts "{:foo :bar}" --compile hello-world.core
@pesterhazy turns out to be a tools.deps issue https://dev.clojure.org/jira/browse/CLJS-2759?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=49246#comment-49246
i'm interested to know how people go about understanding issues when the cljs tools fail with a stacktrace. Ideally the tool would fail more gracefully or helpfully. I'm a cljs newbie and i've been baffled a number of times with such failures. I could imagine using a debugger to work back from the stacktrace to try to gain some insight and so maybe thats would i should get more practiced at.
@grahamcarlyle thanks for filing the issue, this will help the next person find the issue in tools.deps
https://medium.freecodecamp.org/a-real-world-comparison-of-front-end-frameworks-with-benchmarks-2018-update-e5760fb4a962 <- just benchmark including cljs. I post it here, beucase it can be interesting to read.