Fork me on GitHub

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)


@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 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


I don't. will try adding that now.


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


yeah I get it - we do check in lock file as well. thanks


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


I don't know a single one that didn't end up regretting that 😛

Roman Liutikov12:11:24

👋 Is it possible to trigger shadow’s heads up view to display an error message thrown during macro expansion time?

Stephen Wiseman16:11:02

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?

Roman Liutikov18:11:24

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

Roman Liutikov18:11:37

on the other hand NPEs are showing up

Roman Liutikov18:11:42

could be a bug?


what kind of assertion errors? just assert?


shows up as expected for me

Roman Liutikov22:11:42

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?

Stephen Wiseman19:11:13

Thanks. I was thinking this was the case. Thanks again for bearing with me and my questions!