This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-08-08
Channels
- # architecture (8)
- # beginners (78)
- # boot (20)
- # cider (81)
- # clara (53)
- # cljdoc (10)
- # cljsjs (3)
- # clojure (55)
- # clojure-boston (1)
- # clojure-dev (25)
- # clojure-nl (3)
- # clojure-uk (65)
- # clojurescript (65)
- # core-async (1)
- # cursive (41)
- # data-science (4)
- # datomic (16)
- # editors (74)
- # emacs (17)
- # events (1)
- # figwheel (3)
- # hyperfiddle (39)
- # immutant (16)
- # jobs-discuss (62)
- # juxt (2)
- # keechma (2)
- # leiningen (6)
- # mount (7)
- # nrepl (1)
- # off-topic (30)
- # onyx (14)
- # protorepl (2)
- # re-frame (4)
- # reagent (15)
- # reitit (19)
- # shadow-cljs (102)
- # sim-testing (1)
- # spacemacs (44)
- # specter (15)
- # tools-deps (50)
- # vim (2)
I've done npm install d3
and setup to resolve to "d3/build/d3.js", as recommended in the book, but get the error: "ExceptionInfo: could not find module-entry: d3/build/d3.js".
@cjmurphy ideally don't require the d3 meta package. instead require only the parts you actually need. d3 was split up into many smaller packages for this reason. see https://www.npmjs.com/search?q=d3-
it pretty much maps 1:1. so if you used d3.color
before thats just imported via d3-color
now
I was doing that but mot examples have js/d3
as what they start with. See https://stackoverflow.com/questions/51728357/d3-javascript-translation-to-clojurescript/51728732#51728732
well if you don't care about download size too much you can use d3
directly too. its really just an optimization to only require the smaller packages
I want to call the function: (.interpolateWarm)
, but there is no context, so how do I call it?
(:require ["d3" :as d3])
means that you pull d3 into the local scope. js/d3
is the global scope, just use d3
instead
or even better (:require ["d3-interpolate" :refer (interpolateWarm)])
and then (interpolateWarm 30)
and btw (:require ["d3" :as d3])
should work just fine today. they were in a weird state packaging-wise for a while but all of that was sorted out.
import {interpolateWarm} from 'd3-scale-chromatic';
is (:require ["d3-scale-chromatic" :refer (interpolateWarm)])
and then just (interpolateWorm ...)
there is a translation table available here: https://shadow-cljs.github.io/docs/UsersGuide.html#_using_npm_packages
So (:require ["d3" :as d3])
should work, and I do need it right? But not working for me at the moment.
no config whatsoever, so if you took the :resolve
config example you need to remove that
I'm experimenting with a couple of options for quickly create shadow-cljs projects. pretty much all templates that currently exist use lein
and I want non-lein options. One option I'm properly abandoning is npx create-cljs-project
. I was just messing with a couple ideas for UI but it doesn't actually create anything yet. it already bugs me that its way too slow though
$ npx create-cljs-project foo
npx: installed 35 in 18.384s
? Name of your project? test
? Which target? Browser
? Would you like some demo content? re-frame - A Reagent Framework For Writing SPAs, in ClojureScript.
#js {:project-name "test", :target :browser, :template :re-frame}
@thheller is there an example repo for new projects?
There is boot-new which works great for boot project templates
basic ground rules: this is for JS devs. neither boot nor lein are available. not going to make them install that first.
oh btw, we moved our CI runner to it’s own EC2 and starting + compiling takes <1 min now 😉
hehe I bet. did you notice a difference in start up with AOT? or were you on deps/lein anyways?
we’re using lein, but I’m working on migrating us off of that so we can take advantage of that as well
you can do it in lein but I do not recommend it if you have any CLJ server side code
@thheller you could use mustache templates and build a command into shadow-cljs
(ns shadow.cljs.create.cli
(:require
[goog.object :as gobj]
["inquirer" :as inq]
["mustache" :as mst]
["fs" :as fs]))
that was the plan ... but install time matters to me and if the baseline is 18sec I'm doing something else.
I'm stronly considering implementing https://github.com/thheller/shadow-cljs/issues/290 so npm
doesn't take forever installing all the shitty deps
http://npm.broofa.com/?q=shadow-cljs this is already pretty ridiculous ... just because of babel
every time I start a new test shadow-cljs project I already forgot what I wanted to do by the time it finished installing
yeah that is a bummer. I remember reading about some weird WSL disk issues, I wonder if it’s related
don't really have any issues ... its just slow. there is an open ticket about it but doesn't seem to be a priority
Is there a trick to make shadow-cljs not load whole libraries? e.g. I refer from @material-ui/icons
like so:
["@material-ui/icons" :refer [PlayArrow Pause Stop]]
it slows down incremental compilation significantly, 3-4 seconds on my machine. And now something worse is happening: my browser stops loading with a failed to load resource: net::ERR_INSUFFICIENT_RESOURCES
. It seems to load a ton of node_modules.yes. only require what you need. (:require ["@material-ui/icons/PlayArrow" :default PlayArrow])
Okay, I hoped :refer would be smart. But I understand that might be hard (impossible) to implement.
@bbss I have used http://react-icons.github.io/react-icons/ and it seems to play nice, specially if you only include the icons you need (they have each separated in its own file)
Cool, I'll give it a look. The approach of requiring as default works too, but it's a bit cumbersome.
just updated to 2.4.33 and seeing this error:
Exception in thread "main" java.lang.NoSuchMethodError: com.cognitect.transit.TransitFactory.writer(Lcom/cognitect/transit/TransitFactory$Format;Ljava/io/OutputStream;Ljava/util/Map;Lcom/cognitect/transit/WriteHandler;Ljava/util/function/Function;)Lcom/cognitect/transit/Writer;