This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-06-04
Channels
- # announcements (13)
- # asami (68)
- # babashka (19)
- # beginners (51)
- # calva (4)
- # cider (3)
- # clj-kondo (13)
- # clojure (161)
- # clojure-australia (3)
- # clojure-europe (21)
- # clojure-nl (4)
- # clojure-spec (9)
- # clojure-sweden (13)
- # clojure-uk (9)
- # clojured (14)
- # clojurescript (7)
- # conjure (4)
- # cursive (16)
- # data-science (2)
- # datalog (1)
- # figwheel-main (7)
- # graalvm (18)
- # helix (14)
- # introduce-yourself (1)
- # jackdaw (9)
- # jobs (1)
- # kaocha (1)
- # malli (8)
- # meander (8)
- # off-topic (7)
- # pathom (11)
- # proletarian (3)
- # shadow-cljs (29)
- # tools-deps (106)
- # xtdb (8)
I am trying to create a library that is going to be included in a script
tag in another shadow-cljs project. The problem I am facing is that it seems that a shadow$provide
global variable is created for each build, and because of this, the second variable overwrites the first one producing a Module not provided
.
I've tried the :browser
and the :node-library
targets and both of them seem to have the same problem. What is the best way to get around this?
@diego.vid.eco it is not a good idea to use 2 separate CLJS builds on the same page. both will end up including cljs.core
and all other dependencies leading to a lot of bloat. they also won't be compatible with each other and can't exchange CLJS datastructures. ideally make the library part of the compilation of the second one, like any other CLJS libs.
I see. And it makes sense. I originally wanted to develop a couple of plug-n-play libraries for an art project, where also others could plug in their own developments. So that's why I didn't intend to have them "installed" by default on the hosting webpage. Seems like I may have to reconsider some things, but might not be much of a problem.
yeah unfortunately there is no way to really do this properly in CLJS. even if I isolated shadow$provide
more that doesn't fix all the other problems you'd have.
JS has the same issues if you have 2 libs using immutable-js or so. things can talk to each other fine with just JS objects but everything else breaks.
is it possible to have multiple shadow-cljs builds with different dependencies. i.e. I want to produce a js npm package (that doesn't depend on react, helix etc) and a cljs live-reloading demo of the package (that does depend on react, helix etc), but preferably from the same overall project
in general your dependencies decide nothing about the build. the build config controls how or what is included, not the dependencies you have listed in your project
what is a live-reloading demo? for people checking out the repo and running it locally you mean?
yep, the npm library will be consumed by js projects
the live-reloading demo is exactly for the cljs devs so that we can check out the lib and make modifications to it and see it in action
to build the library you can use :target :node-library
or :target :npm-module
, those by default don't bundle JS dependencies, only compiled CLJS code
ah ok
I'll have a go 🙂
made that a long time ago. config is unchanged though. just need to bump a few versions
the :entries
key is a list of clojurescript namespaces to include in the npm package?
great, thanks
yes, so I'm hoping that when I change them... the styling on the browser also changes
how do I use latest shadow-cljs from github?