This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # adventofcode (36)
- # aleph (1)
- # announcements (7)
- # aws (4)
- # babashka (9)
- # beginners (61)
- # calva (79)
- # cider (19)
- # clojure (48)
- # clojure-austin (1)
- # clojure-australia (2)
- # clojure-czech (2)
- # clojure-europe (46)
- # clojure-france (8)
- # clojure-nl (19)
- # clojure-uk (4)
- # clojuredesign-podcast (14)
- # core-logic (42)
- # data-science (3)
- # datalevin (8)
- # datomic (76)
- # events (1)
- # figwheel-main (9)
- # fulcro (6)
- # helix (1)
- # holy-lambda (1)
- # honeysql (2)
- # jobs (2)
- # jobs-discuss (20)
- # leiningen (5)
- # lsp (87)
- # minecraft (11)
- # nextjournal (4)
- # off-topic (17)
- # practicalli (1)
- # reagent (22)
- # reitit (8)
- # releases (3)
- # rum (2)
- # shadow-cljs (18)
- # sql (11)
- # tools-build (5)
- # tools-deps (9)
- # xtdb (20)
I try to release a
node-script , it works fine if I run
node target/main.js. However, it seems to depend on
node_modules . If I move
target/main.js to somewhere else, it can't find required module anymore. Is it expected? How can I have a single file bundle?
I have two apps, the smaller one can be bundled by ncc, the larger one can not. The error is
Error: Cannot find module 'qs', looks like it still looking for something in
node_modules. I tried to
(js/require "qs"), but it seems doesn't work. Any suggestion on what should I do for further debugging?
It's weird to because I can found qs in node_modules, I can even run
target/main.js without any problems. So I have no idea which side cause the problem. Is the generated
target/main.js has a statement that ncc can not recognize? or I just ran into a bug of ncc.
Hi all, I'm trying to use d3 in a cljs project. I'm working with shadow-cljs and I'm pretty new to both shadow-cljs and d3 so expecting this might be a stupid mistake.
I did a
yarn add d3 which seems to have done what I expected and added a bunch of d3 modules into
I'm requiring d3 like so:
and some of it appears to work, as I can run these refers in my REPL, and the interop functions as I'd expect
(ns browser (:require ["d3" :as d3] ["d3-scale" :refer [scaleLinear]] ["d3-shape" :refer [line]]))
However I can't seem to get any 'select' type functions to work, I tried using interop:
(-> (scaleLinear) (.domain #js [1 2])) => #object[scale]
I've also tried following the refering format but had no luck with that either:
(.select d3 "#app") Execution error (TypeError) at (<cljs repl>:1). module$node_modules$d3$src$index.select is not a function
Does anyone know how I'm meant to access the select function? I'm vaguely trying to achieve what they're doing here https://github.com/scotthaleen/cljs-d3-force-direct-graph/blob/master/src/haleen/fd/graph/core.cljs#L17 except they use the global context for d3 which doesn't work either for me, and from what I've read, shouldn't really be done. Thanks for any help!
["d3-selection" :refer [select]] (select) Execution error (TypeError) at (<cljs repl>:1). _select is undefined
Hope I'm not derailing too extensively here, but have you looked at Vega or Vega-Lite for data visualizations? Vega-Lite is a bit higher level, but also quite a bit higher leverage. If you need to do something very precise or custom, Vega is extremely capable (e.g. someone once literally built pacman in Vega). Both are very well supported by a number of Clojure tools/wrappers, including https://github.com/metasoarous/oz (which I maintain), Hanami, darkstar, notespace, clerk, etc. As data APIs complete with a dataflow model for dynamic computations and interaction, they're also extremely declarative, and mesh very well with the Clojure philosophy. Obviously, if you want/need to use d3 for some very specific reason, then go right ahead. But if you just need to get some shit done, you may have an easier time using one of these libraries.
Hi @U05100J3V, appreciate the information, I hadn't heard of Vega and am new to the ecosystem as a whole so no real need to use d3, my main requirement currently is for a force-directed graph which looks supported so I will take a look, thanks!
Is there a way to hide deprecated var use warnings for a particular set of vars while still showing for vars not in that set?
@dstephens do you get any errors during loading? see the browser console? I would expect things to exist but maybe something failed to load properly?
@thheller Yes, I have found some errors!
I've looked in the generated numbers.js and it seems to failing on this:
shadow-cljs - failed to load module$node_modules$d3_array$src$number js.js:74:16 shadow-cljs - failed to load module$node_modules$d3_array$src$bisect js.js:74:16 shadow-cljs - failed to load module$node_modules$d3_array$src$index js.js:74:16 shadow-cljs - failed to load module$node_modules$d3$src$index js.js:74:16 An error occurred when loading abc.js main.js:1672:15 [email protected]://localhost:8020/js/cljs-runtime/module$node_modules$d3_array$src$number.js:5:400 [email protected]://localhost:8020/js/cljs-runtime/shadow.js.js:34:18 [email protected]://localhost:8020/js/cljs-runtime/module$node_modules$d3_array$src$bisect.js:1:521 [email protected]://localhost:8020/js/cljs-runtime/shadow.js.js:34:18 [email protected]://localhost:8020/js/cljs-runtime/module$node_modules$d3_array$src$index.js:17:485 [email protected]://localhost:8020/js/cljs-runtime/shadow.js.js:34:18 [email protected]://localhost:8020/js/cljs-runtime/module$node_modules$d3$src$index.js:1:164 [email protected]://localhost:8020/js/cljs-runtime/shadow.js.js:34:18 [email protected]://localhost:8020/js/cljs-runtime/shadow.js.js:59:20 @http://localhost:8020/js/cljs-runtime/abc.js:2:48 [email protected]://localhost:8020/js/main.js:577:21 SHADOW_ENV</[email protected]://localhost:8020/js/main.js:1670:12 @http://localhost:8020/js/main.js:2360:12
Tried googling about
regeneratorRuntime undefinedand found https://stackoverflow.com/questions/53558916/babel-7-referenceerror-regeneratorruntime-is-not-defined I can try this but I'm not really sure what it's doing
yarn add core-js yarn add regenerator-runtime
the regenerator thing you maybe can fix by doing a
(:require ["regenerator-runtime/runtime"]) before your d3 or other js requires
> older shadow-cljs verison Very likely, I was just trying to add a few things into a previously working (to the best of my limited knowledge) play project I had. Thanks, I'll try updating and adding that and see how it goes!