This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-09-10
Channels
- # beginners (151)
- # cider (41)
- # cljdoc (7)
- # cljs-dev (6)
- # clojure (92)
- # clojure-dev (5)
- # clojure-italy (26)
- # clojure-losangeles (1)
- # clojure-nl (10)
- # clojure-russia (3)
- # clojure-spec (23)
- # clojure-uk (82)
- # clojurescript (56)
- # clojutre (1)
- # core-async (3)
- # cursive (15)
- # datomic (26)
- # editors (3)
- # emacs (3)
- # events (2)
- # figwheel-main (192)
- # fulcro (66)
- # leiningen (12)
- # mount (1)
- # off-topic (131)
- # portkey (6)
- # re-frame (38)
- # reagent (10)
- # reitit (7)
- # ring-swagger (55)
- # shadow-cljs (21)
- # spacemacs (11)
- # tools-deps (48)
I'm trying to play around with http://ptsjs.org/, which can be installed with npm i pts
. Doing a naive (:require ["pts" :refer Pt])
gives me the following error:
--- node_modules/pts/dist/index.js:3828
This code cannot be converted from ES6. extending native class: Float32Array
--- node_modules/pts/dist/index.js:4022
This code cannot be converted from ES6. extending native class: Array
How do I approach this? There's a minified version in dst that contains different non-convertible es6-code and an es5-version that's follows UMD from what I can see. Trying to require the es5-version gives me No such namespace: Pt, could not locate Pt.cljs, Pt.cljc, or JavaScript source providing "Pt"
.@arne-clojurians you can probably set :js-options {:language-out :ecmascript6}
in your build config
now i'm slightly confused... there's a shadow.js.babel
in the shadow
global variable? i skimmed the docs and it said something about running babel yourself for things like jsx interop, but there's a bundled babel as well?
@arne-clojurians I ran into this a little while ago. I posted an issue here: https://github.com/williamngan/pts/issues/22
did you try to bundle your code with advanced optimizations? basically as soon as i do (.. form (stroke "#abc") (fill "#def"))
it tries to optimize to heavily. even if i type-hint form
it can't infer the call to stroke and won't know what it returns, causing it to not find fill
which has been obfuscated
so what i do now is (.. form ^js (stroke "#abc") ^js (fill "#def"))
... but this doesn't feel like a sensible thing to do
maybe @U05224H0W knows something about this, is this a problem of closure compiler and chaining APIs?
this is my config https://github.com/Lokeh/lilac.town/blob/master/shadow-cljs.edn#L8
@arne-clojurians it is not on auto by default. you must turn it on. I think ..
has a bug in that it doesn't propagate typehints properly
@arne-clojurians the built-in babel
is used to transform ES6 code from node_modules
only.