This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-03-27
Channels
- # announcements (3)
- # aws (7)
- # babashka (11)
- # beginners (96)
- # clojure (15)
- # clojure-europe (9)
- # clojure-germany (2)
- # clojure-italy (1)
- # clojure-nl (3)
- # clojure-poland (3)
- # clojure-serbia (1)
- # clojurescript (13)
- # depstar (28)
- # fulcro (34)
- # graalvm (5)
- # honeysql (5)
- # malli (11)
- # off-topic (27)
- # pathom (9)
- # polylith (74)
- # portal (10)
- # re-frame (13)
- # releases (1)
- # ring (8)
- # shadow-cljs (3)
- # spacemacs (10)
- # tools-deps (8)
I'm having issues using the vega-embed library from npm with shadow-cljs that I would like some help with. I will put all the details of my problem in a thread so it doesn't get too noisy.

In my package.json I have the following dependencies declared
"dependencies": {
...
"vega": "5.20.0",
"vega-embed": "6.17.0",
"vega-lite": "5.0.0"
...
}
When the application starts up, these warnings show up in the browser console
as soon as the application loads.
shadow-cljs - failed to load module$node_modules$d3_array$dist$d3_array js.js:74:16
shadow-cljs - failed to load module$node_modules$vega_format$build$vega_format js.js:74:16
shadow-cljs - failed to load module$node_modules$vega_loader$build$vega_loader js.js:74:16
shadow-cljs - failed to load module$node_modules$vega_dataflow$build$vega_dataflow js.js:74:16
shadow-cljs - failed to load module$node_modules$vega$build$vega_node js.js:74:16
shadow-cljs - failed to load module$node_modules$vega_embed$build$vega_embed
In my cljs code, I'm attempting to use the vega library like this.
(ns components.charts.vega-chart
(:require
;; ...
["vega-embed" :as vega-embed]))
;; later in the namespace
(vega-embed/embed node spec options)
The value of vega-embed
is an empty javascript object. The problem seems to be occuring before I even get to exectue this code.
If I evaluate any of my cljs code that makes use of vega-embed
I get a bunch of errors that all trace back to the vega code not being loaded (nils, not a function, etc)
Would anyone be able to help me get to the bottom of this?Damn. Everytime I sit down and write up a big question for slack I find a solution right after.
Adding :output-feature-set :es6
to my shadow-cljs :compiler-options
map fixed this for me. I got the idea from this post https://stackoverflow.com/questions/64461818/require-aws-amplify-v-3-amplify-and-auth-classes-in-clojurescript-reagent-shadow