shadow-cljs

https://github.com/thheller/shadow-cljs | https://github.com/sponsors/thheller | https://www.patreon.com/thheller
Lucy Wang 2020-09-21T02:50:18.059800Z

another option is to can add your devcards ns to the :preload section, e.g. https://github.com/lucywang000/sctools/blob/mvp1/shadow-cljs.edn#L164

đź‘Ť 1
theeternalpulse 2020-09-21T05:43:58.060100Z

interesting, I saw another option `

:dev {:compiler-options {:devcards true}}
in the docs, I'll try adding that as well

theeternalpulse 2020-09-21T05:44:37.060300Z

thanks for the better path, double compile seemed bloated

Helins 2020-09-21T07:18:04.064500Z

Does shadow-cljs have trouble with index.js files? NPM package A (`querystring`) emulates a node module, its entry point is index.js. It is required by NPM package B in my dependencies (`require("querystring")` ). Compilation fails because the compiler cannot find dependency querystring . I, on the other hand, can require it by mentioning (:require ["querystring/index"]) . Indeed, I can fix this by altering altering package B to specify require("querystring/index") but it is a brittle solution at best. What would be a better fix?

thheller 2020-09-21T08:15:47.065200Z

@adam678 the correct fix is npm install shadow-cljs in your project. which you should be getting a warning on startup about.

thheller 2020-09-21T08:16:10.065700Z

querystring is one of those node polyfill packages which will be installed if you npm install shadow-cljs

Helins 2020-09-21T09:12:36.066500Z

@thheller Thanks, indeed it works. However, I don't think there was any warning besides a suggestion to run npm install querystring which didn't do the trick anyway

thheller 2020-09-21T09:20:13.067100Z

maybe you are on an older version that didn't warn about this?

2020-09-21T16:33:57.069400Z

@thheller I was digging into the first error with reframe.db/app-db and now I have to use (require 're-frame.db) to make it work. What did make this change?

thheller 2020-09-21T16:35:34.070Z

@pavel.klavik I don't understand what you mean. I don't have enough context about what you are doing

thheller 2020-09-21T16:36:53.071200Z

makes things a million times easier if you just paste a shadow-cljs cljs-repl app session or so

thheller 2020-09-21T16:37:15.071800Z

too many other things may be going when when using nREPL so I need waaaaaaaaaaay more information to provide any kind of help

2020-09-21T16:40:51.072600Z

I just checked and no idea how to reproduce it, everything works just fine now

2020-09-21T16:41:53.073300Z

recently I am getting more errors of the type posted above, not sure what is causing it, but it is somehow related to code reloading

2020-09-21T16:42:17.073900Z

if I get more insight into what could be causing the errors, I will let you know

benny 2020-09-21T17:32:40.077400Z

what’s the best way to set up a multi-project repo like so:

project
|-- api
|   |-- src\clj
|
|-- client 1
|   |-- src\cljs
|
|-- client 2
    |-- src\cljs

wilkerlucio 2020-09-21T18:50:21.078700Z

hello, is there a way to increase the timeout of waiting for a REPL command response?

thheller 2020-09-21T18:51:48.079200Z

not currently. open an issue please so I don't forget.

âś… 1
2020-09-21T18:55:58.079300Z

I don't see much value in different directories for clj, cljs and cljc files.

2020-09-21T18:57:14.079500Z

I personally have a single src directory with multiple subdirectories which copy my project structure: src/project/client (cljs files) src/project/server (mostly clj files) src/project/common (cljc files) src/project/css (clj files for Garden) and a few others

benny 2020-09-21T18:59:51.079700Z

but i ultimately have 3 deployable units, does it still make sense to do it this way though

2020-09-21T19:20:48.080100Z

sure, you have three deployable units, but they might share some code (at least we share a lot of code in between)

2020-09-21T19:21:39.080300Z

so I would recommend having everything in a single repo (at least till it is possible), and separating everything in build time (you specify the root namespaces and only their dependencies will be included in your build)

benny 2020-09-21T19:45:43.080500Z

I currently have one shadow project already (react native) and i’ll have another one (react web) so my biggest problem is the vast difference in dependencies they have and how to manage that

2020-09-21T19:47:18.080700Z

As with everything, I would choose the simplest way unless you have a good reason not to. I think we currently have single list of Shadow-cljs dependencies and the right dependencies get picked up during compilation, but maybe some other way is prefered here.

benny 2020-09-21T19:55:56.080900Z

ah, true, i recall @thheller explaining that — how only what your used references are compiled

benny 2020-09-21T19:56:16.081100Z

i’ll give er a go, thanks @pavel.klavik that gives me the confidence to trudge forward

thheller 2020-09-21T19:57:56.081300Z

why do you set it up this way? wouldn't just :client1 :client2 builds be enough?

benny 2020-09-21T20:10:30.081500Z

i’m using cursive so loading up the project via lein is ideal and afaik i can’t specify different lein targets with different shadow builds

benny 2020-09-21T20:11:06.081700Z

this is ultimately what i’m trying to figure out — what the ideal is all things considered, especially since i’m using lein + shadow

benny 2020-09-21T20:11:47.081900Z

right now i have this in the root of my shadow project :lein {:profile "+client"}

benny 2020-09-21T20:11:59.082100Z

now i’m introducing another client

thheller 2020-09-21T20:18:09.082300Z

if you are using lein anyways then just do whatever you do in lein

thheller 2020-09-21T20:18:17.082500Z

you don't have to use the shadow-cljs command

thheller 2020-09-21T20:19:08.082900Z

lein with-profiles +client2 run -m shadow.cljs.devtools.cli watch build-id

thheller 2020-09-21T20:19:28.083100Z

but you didn't answer why its not just two different builds

thheller 2020-09-21T20:19:33.083300Z

why does it have to be lein profiles?

benny 2020-09-21T20:19:45.083500Z

because of the different dependencies they have

thheller 2020-09-21T20:19:59.083700Z

why is that a problem?

benny 2020-09-21T20:20:05.083900Z

but to @pavel.klavik’s point, separating the deps won’t matter much since they’re just pulled in based on usage

thheller 2020-09-21T20:20:43.084100Z

exactly. the builds only include what they actually used/required. you can have thousands of extra depenendencies and that won't matter at all

benny 2020-09-21T20:20:46.084300Z

so ultimately that’s where i guess we landed — i’ll just use the superset of deps in lein and different builds in shadow

benny 2020-09-21T20:21:06.084500Z

sweet, even more confident, thanks guys

wilkerlucio 2020-09-21T21:22:17.084800Z

https://github.com/thheller/shadow-cljs/issues/787