This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-11-24
Channels
- # announcements (4)
- # asami (5)
- # babashka (20)
- # beginners (94)
- # bristol-clojurians (1)
- # calva (23)
- # cider (2)
- # clj-commons (3)
- # clj-kondo (43)
- # cljfx (2)
- # cljs-dev (13)
- # clojure (112)
- # clojure-dev (44)
- # clojure-europe (17)
- # clojure-nl (5)
- # clojure-poland (12)
- # clojure-spec (2)
- # clojure-uk (3)
- # clojurebridge (1)
- # clojurescript (92)
- # cursive (17)
- # data-science (8)
- # datahike (1)
- # datalevin (1)
- # datomic (3)
- # deps-new (7)
- # events (2)
- # fulcro (40)
- # graalvm (110)
- # holy-lambda (16)
- # introduce-yourself (1)
- # lsp (13)
- # malli (8)
- # missionary (12)
- # off-topic (10)
- # pathom (13)
- # polylith (10)
- # portal (28)
- # re-frame (37)
- # reitit (1)
- # releases (1)
- # shadow-cljs (30)
- # spacemacs (1)
- # tools-deps (9)
- # xtdb (10)
Hi - is there a way for shadow-cljs to produce import ...
instead of require ...
in the resulting JS?
The reason for that is that I have to interface with some libs that only use import
in node.js, and I would like to not have to use an external bundler (to not loose the power of the REPL for development, for example)
@mauricio.szabo :target :esm
does that, see https://clojureverse.org/t/generating-es-modules-browser-deno/6116
@hoertlehner deps.cljs
files just need to be on the classpath, it doesn't matter whether thats in a jar or just a directory. combining them when building a jar is something you need to do as a jar can only contain one
I'm trying to use https://github.com/JedWatson/react-select in a build and shadow is complaining that the required dependency "process" is not available
There is no declared dependency on process
but I can see in the code there is if (typeof process !== 'undefined'
so it's basically doing a polyfill. I can see why shadow has flagged it, but is there any opt to get shadow to let this kind of thing through?
@henryw374 I'm guessing you don't have shadow-cljs
npm package installed in the project. which means you are also missing the polyfills that provides. basically just npm install shadow-cljs
installing that worked, thanks @thheller. I can add shadow-cljs to my deps.cljs file, but that necessarily means putting the required shadow-cljs version there and also in deps.edn for the shadow-cljs maven lib.
I don't understand. this is about polyfills so you should most definitely never add shadow-cljs
to your deps.cljs
file?
to work around the original problem I needed the npm shadow-cljs package. currently my deps.edn file has shadow mvn dep in it, so then if I'm also adding npm shadow, I need to ensure its version matches the mvn version
to get the shadow-cljs npm dep I add it to my project's deps.cljs file, but that's just my preference rather than just putting it in package.json
you MUST have it in package.json
as well as you MUST keep your package-lock.json
in version control. not doing this is NOT an option in the JS world, unless you like pain of course
if you really must put this in deps.cljs
then put node-libs-browser
there, not shadow-cljs
sure, it ends up in package.json anyway and they get committed. but at least in deps.cljs i can have comments etc. ok thanks i will try that lib instead
yeah I'm just saying that due to the extensive use of version ranges in the npm world you really must keep a lock file and therefore maintain a package.json as well
otherwise you basically get random results when installing stuff which is never good
I know a few people that tried to use npm as if it didn't exist and ignored package.json and lockfiles and so on
👋 Is it possible to trigger shadow’s heads up view to display an error message thrown during macro expansion time?
It it possible to still use leiningen, but defer to shadow to manage cljs build + dependencies? Our current dev workflow is to start a repl using lein, then leverage component lifecycles to start/stop the different components of the app (both backend and frontend components). For the front-end component, we call the shadow api to start a shadow server and a shadow watch. The subsequent build always seems to use the lein dependencies. In contrast, if I test by simply starting a watch using the shadow cli, it will use the dependencies in shadow-cljs.edn
, which is what I’m going for.
@roman01la I don't understand the question. they should already show up?
hm, not really, for me assertion errors are not showing up, instead shadow’s hot reload icon keeps spinning in a browser, but the error is indeed printed in the terminal
on the other hand NPEs are showing up
could be a bug?
hm, could be something with my setup then
@swiseman108 dependencies are managed when starting the JVM since they are JVM dependencies. so however you started the JVM will decide which dependencies shadow-cljs sees. so I guess the answer is no?
Thanks. I was thinking this was the case. Thanks again for bearing with me and my questions!