This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-07-25
Channels
- # announcements (22)
- # architecture (6)
- # beginners (76)
- # cider (44)
- # clara (6)
- # clj-kondo (34)
- # cljdoc (4)
- # cljs-dev (8)
- # clojure (162)
- # clojure-brasil (4)
- # clojure-dev (32)
- # clojure-europe (3)
- # clojure-italy (16)
- # clojure-japan (4)
- # clojure-nl (3)
- # clojure-poland (1)
- # clojure-spec (25)
- # clojure-uk (45)
- # clojuredesign-podcast (5)
- # clojurescript (91)
- # clojutre (3)
- # core-async (19)
- # core-logic (8)
- # cursive (60)
- # data-science (3)
- # datomic (7)
- # defnpodcast (2)
- # duct (5)
- # emacs (7)
- # fulcro (1)
- # graalvm (9)
- # graphql (1)
- # jackdaw (12)
- # jobs (1)
- # jobs-discuss (1)
- # kaocha (3)
- # leiningen (3)
- # luminus (2)
- # off-topic (44)
- # onyx (17)
- # pathom (6)
- # planck (15)
- # re-frame (1)
- # reagent (13)
- # rum (2)
- # shadow-cljs (43)
- # spacemacs (3)
- # sql (43)
- # tools-deps (3)
- # vim (43)
- # xtdb (13)
does anyone have any experience exporting npm
packages that work in the browser as well?
i apologize if this question is misguided. the manual is a painstaking cliff hanger (https://shadow-cljs.github.io/docs/UsersGuide.html#_creating_code_npm_code_packages). i guess im primarily curious whether a webpack workflow would appropriately handle making a :node-library
output browser compatible
right, getting more familiar with it. seems like its working well. using this tool has never stopped being positively delightful
@isak I'm trying to write style in cljs, with runtime insertion by library like cljss or herb. not know how will it work in the end yet.
Does shadow-cljs fully supports macro system?
(ns infrastructure.util
(:require
[clojure.tools.macro :as macro]
[promesa.core :as p]))
(defmacro defn-handler
[name & attrs]
(let [[aname [fn-args & fn-body]] (macro/name-with-attributes name attrs)
args-count (count fn-args)
afn `(fn ~fn-args ~@fn-body)]
`(def ~aname
(fn [req1# res1# next1#]
(-> (p/promise (if (= ~args-count 3)
(~afn req1# res1# next1#)
(~afn req1# res1#)))
(p/catch #(next1# %)))))))
I've just created macro which is used to define the express.js handlers.
(defn-handler get-login-status
[req res]
(println req res))
For some reason code works perfectly fine but the shadow-cljs outputs a warning:I've seen a lot of times like something is undeclared but actually it exists. usually cased by how the namespace is created. is it created by file require or by repl evaluation.
@doglooksgood Ok found one bug. The last warning about undeclared is fixed. So there is one left about "wrong number of args passed".
Ok I see why 馃槢
you can use deps.edn or leiningen to manage dependencies, is easy for shadow-cljs to use them. so all the tools are available now.
@doglooksgood yeah, was hoping there is something shadow-cljs specific, thanks
@karol.wojcik that is not how macros work in CLJS. they need to be declared in a CLJ namespace (.clj or .cljc)
Hi, does shadow-cljs supports dynamic require() in the JS code? I have problem with this JS code that does not work well (not sure yet how):
const required = require(`../vectors/${name}`);
vector = required.default || required;
It works fine when used from a JS project.
@vincent.cantin no that is not supported. you can do it when building for node by just using js/require
directly but it is not supported otherwise
thank you
I鈥檝e been thinking about a way to include and instrument specs that wouldn鈥檛 have production runtime cost
if each ns my-project.thing
had a corresponding my-project.thing-spec
, we could watch for the creation of those files and add their require to a ns that was included via a preloads-like method at dev-time
I鈥檓 thinking of building this as a standalone tool but could be nice as a shadow-cljs feature too
hmm interesting. does the build state have information about files on the classpath that aren鈥檛 included in the dependency graph?
@lilactown had you tried #ghostwheel? it has a stub thing that can pretty elide all specs and fdefs in prod, both for Clj and CLJS
(the spec part is coming on the next release, but the alpha of it works fine so far)
atm I see cljs.spec.alpha + cljs.spec.gen.alpha + cljs.spec.test.alpha taking a combined ~100kb
yesterday I was advised to switch my dependency from cider/cider-nrepl "0.21.0"
to nrepl "0.6.0"
which worked in letting me hook vim into the running nrepl. But I now don't have access to cider and all it gives me, including functionality from other plugins that require cider. The folks at #cider tell me they are very different dependencies but I can't get both the nrepl and the cider-nrepl dependencies in this shadow-cljs to work together. Any advice on how to get Cider working right (outside of emacs, I'm using vim)?
@chase-lambert nrepl and cider-nrepl are 2 different things so you need both
@lilactown you can brute force remove all of spec with this https://shadow-cljs.github.io/docs/UsersGuide.html#_code_stripping
but that'll break a bunch of stuff is something actually needs to use spec at runtime
I kinda like your idea of automatically include *.thing-spec
namespaces for dev builds but instrumentation is tricky enough. automating it entirely and getting that right reliably might be tricky