This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-07-22
Channels
- # announcements (1)
- # aws (4)
- # beginners (73)
- # bristol-clojurians (1)
- # calva (7)
- # cider (5)
- # cljs-dev (11)
- # cljsrn (3)
- # clojure (30)
- # clojure-europe (24)
- # clojure-italy (2)
- # clojure-nl (3)
- # clojure-spec (7)
- # clojure-uk (69)
- # clojurescript (109)
- # cursive (21)
- # datascript (1)
- # datomic (72)
- # events (1)
- # fulcro (5)
- # graalvm (2)
- # helix (12)
- # hoplon (12)
- # jobs (2)
- # juxt (2)
- # kaocha (7)
- # keechma (1)
- # lambdaisland (5)
- # meander (18)
- # off-topic (52)
- # pathom (9)
- # re-frame (18)
- # reagent (5)
- # reitit (7)
- # sci (6)
- # shadow-cljs (76)
- # sql (9)
- # testing (4)
- # tools-deps (14)
- # xtdb (28)
Q: I’m trying to get a react-vega sample working but I’m failing. Does anyone have a really simple example of this in shadow?
I don't know. I get an empty div. Hence the question. I'm pretty sure I'm doing the reagent interop wrong
(:require ["react-vega" :refer [VegaLite Vega]]
[reagent.core :as r])
(let [spec (clj->js {:width 400
:height 200
:mark "bar"
:encoding {:x {:field "a"
:type "ordinal"}
:y {:field "b"
:type "quantitive"}}
:data {:name "table"}})
data (clj->js {"table" [{"a" "A" "b" 28}
{"a" "B" "b" 20}]})]
[:> VegaLite {:spec spec
:data data}])
"react-vega": "7.4.0",
"vega-embed": "6.10.0",
"vega": "5.13.0",
"vega-lite": "4.13.1"
but I thought I’d ask here first. don’t waste time on it unless you’ve done it before. I’m hoping I’ll find someone who has done this already
or tomorrow (getting late here) I’ll wake up and find the problem. it’s always easier in the morning
did an update of shadow-cljs
to the latest and started to have this error when compiling:
Cannot import Closure files by path. Use either import goog:namespace or goog.require(namespace)
I am using the experiment feature of requiring js files, and had this import on that files:
import * as THREE from 'three';
@brunex need more context. what build :target
is this in? which version did you upgrade to? did you make sure to upgrade all dependencies properly in case you are using project.clj or deps.edn?
:target :browser
:release {:compiler-options {:optimizations :advanced
:output-feature-set :es8
:source-map true
:pseudo-names true
:cross-chunk-method-motion false}}
@brunex looks fine and works fine for me too. you should definitely remove :pseudo-names true
though. thats for debugging and will make your build huge.
Closure compilation failed with 1 errors
--- client/components/simulation/trackball.js:1
Cannot import Closure files by path. Use either import goog:namespace or goog.require(namespace)
and the JS file you are working only has import
and export
and no other goog.*
stuff?
:dependencies
[
[cljs-drag-n-drop "0.1.0"]
[cljs-http "0.1.46"]
[com.stuartsierra/component "0.3.2"]
[venantius/accountant "0.2.3"]
[com.cemerick/url "0.1.1"]
[com.taoensso/timbre "4.8.0"]
[bidi "2.1.6"]
maybe try deleting the .shadow-cljs/builds
dir. could be that the cache is confused about something.
I found one cache issue related to classpath-js but thats entirely different from your problem
import * as THREE from 'three';
let TrackballControls = function ( object, domElement ) {
....
};
TrackballControls.prototype = Object.create( THREE.EventDispatcher.prototype );
TrackballControls.prototype.constructor = THREE.TrackballControls;
export { TrackballControls };
the idea is to use it as something like this on the cljs side
(:require ["./trackball.js" :as tb])
(tb/TrackballControls. camera element)
Hi!
I'm really trying hard to use an existing macro in my CLJS code, but I get a Error in phase :compilation
error.
The macro I'm trying to use : https://github.com/escherize/tracks
It's written in CLJC so it should work in clojurescript right ?
I added the dependency to my shadow-cljs.edn
:dependencies [[tracks "1.0.6"]]
And in the file I'm trying to use it
(ns dummy
(:require [tracks.core :refer-macros (deftrack)]))
(deftrack calculate-price-for-order
{:a {:c price}
:b {:d quantity}}
(* price quantity))
I also read the post from @thheller (https://code.thheller.com/blog/shadow-cljs/2019/10/12/clojurescript-macros.html) but I'm not sure if this applies to macros from libraries. Following the post, I tried to define a tracks.core namespace in a CLJS file and refer itself, but it doesn't change the error.
Any ideas ?@mathieu.durand it helps if you post the actual error you are getting and not just parts of it. I do not know that library but it looks to me like it might be clojure only
@thheller thats the thing, there is no more to the error. I only get Error in phase :compilation
and if I wait 15 sec, I get this
Exception in thread "async-dispatch-7" java.net.SocketException: Socket closed
at java.base/java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:113)
at java.base/java.net.SocketOutputStream.write(SocketOutputStream.java:150)
at java.base/java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:81)
at java.base/java.io.BufferedOutputStream.flush(BufferedOutputStream.java:142)
at nrepl.transport$bencode$fn__5881.invoke(transport.clj:109)
at nrepl.transport.FnTransport.send(transport.clj:28)
at nrepl.middleware.print$send_nonstreamed.invokeStatic(print.clj:159)
...
and the shadow-cljs process dies...