This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-10-01
Channels
- # announcements (5)
- # aws (2)
- # babashka (35)
- # beginners (68)
- # bristol-clojurians (1)
- # calva (14)
- # cider (9)
- # clj-commons (5)
- # clojars (3)
- # clojure (101)
- # clojure-australia (6)
- # clojure-europe (35)
- # clojure-italy (2)
- # clojure-nl (5)
- # clojure-spec (1)
- # clojure-uk (4)
- # clojurescript (70)
- # conjure (3)
- # cursive (7)
- # datomic (36)
- # emacs (11)
- # exercism (1)
- # fulcro (23)
- # helix (2)
- # jobs-discuss (15)
- # lsp (17)
- # malli (8)
- # meander (1)
- # nrepl (60)
- # off-topic (10)
- # pedestal (9)
- # react (8)
- # reagent (53)
- # reveal (10)
- # shadow-cljs (27)
- # spacemacs (4)
- # tools-build (4)
- # tools-deps (4)
- # xtdb (2)
I'm sorry if this is answered elsewhere but I really couldn't find it, but, if I'm targeting a node library for my shadow-cljs project, is there a way to tell the closure compiler that some of the dependencies are peer dependencies? Like, I'm making a React component that I want to be able to consume from regular JS, and I'd like for the consuming project to provide react
@mattly Yes, this is possible.
:js-options
{:resolve {"react" {:target :global
:global "React"}}}}
that seems unrelated to the question is only really relevant for browser builds wanting to use stuff from a CDN or so. definitely not node librries
Annoying question alert (b/c the fair answer is "just use shadow-cljs"): I'm trying to package my target-bundled CLJS into an ES module, but I keep running into ReferenceError: self is not defined
from the very early assignment goog.global=this||self
. I have "type": "module"
in my package.json
file and am trying to create an ES module package. Anyone have any pointers as to what is going on there?
Since shadow-cljs has an ES module output feature, was just curious if anyone knew or could point me towards the basic stuff it was doing there
most of the ESM related code is here https://github.com/thheller/shadow-cljs/blob/master/src/main/shadow/build/targets/esm.clj
https://github.com/thheller/shadow-cljs/blob/master/src/main/shadow/build/targets/esm.clj#L323
@U06FS3DLH I have a working setup with :target :esm
for node as well.
Awesome, thank you @U05224H0W!
@U04V15CAJ oh? you mean w/ shadow-cljs or just tools.deps?
interesting. didn't know :target :esm
was an option
More details here: https://clojureverse.org/t/generating-es-modules-browser-deno/6116
(@U05224H0W helped me with this a lot, thanks again)
right, I saw it was an option in shadow-cljs. didn't think it was one w/ just tools.deps (or, I guess, just the plain cljs compiler in that context)
@mattly I'm assuming by "node library" you mean actual :target :node-library
published to npm? that by default doesn't bundle any dependencies so no further configuration is required. whether you declare your dependency on react as a regular dependency or node peerDependency is up to you and doesn't matter from the shadow-cljs perspective