Fork me on GitHub
#shadow-cljs
<
2019-07-31
>
Chris O’Donnell02:07:41

Is there a way to download a project's dependencies without compiling with shadow-cljs? For context, I'm working on a build dockerfile, and I'd like to download dependencies before copying the source directory in for caching purposes.

Chris O’Donnell02:07:46

Also, I'm using deps.edn to write my dependencies.

Chris O’Donnell02:07:52

Realized I could create a separate, dummy build and compile that without copying in the full source directory, using that compile to download dependencies. Should be a good enough workaround.

thheller07:07:27

@codonnell if you use deps.edn anyways just call clj directly, eg clj -Stree or so

thheller07:07:52

don't need to do an actual compile for anything

orestis08:07:14

I’m so mad at the npm world right now. Bumping react-bootstrap from 1.0.0-beta9 to 1.0.0-beta10 just opens a huge can of worms.

orestis08:07:02

Does shadow-cljs have parity with webpack on how it resolves node modules? I can’t imagine that people in JS land go through this all the time, but perhaps I’m wrong and they do.

thheller08:07:10

it does not have parity on purpose. it is way stricter.

thheller08:07:24

but JS people go through this all the time too 😛

thheller08:07:30

whats the problem?

orestis08:07:32

Well, I’m not sure I understand entirely — things fail to load because some js error. The latest is from Vega.js complaining about "renegeratorRuntime" is undefined.

orestis08:07:49

I rolled back my update because I have more important things to do and things work again.

thheller08:07:28

renegeratorRuntime is some babel thing for transpiled code that needs to be included separately for some reason

orestis08:07:34

Another one was _uncontrollable.default is undefined which probably relates to the uncontrollable package. What’s the root issue? Who knows.

orestis08:07:56

Yeah I tried putting nested dependencies at the top. I’ve also tried yarn, not sure if that was a good idea.

thheller08:07:58

just add (:require ["regenerator-runtime/runtime"]) before your JS requires

orestis08:07:05

Oh, I have to require that?

orestis08:07:34

OK, good to know. I’ll try that next time I go through this excursion.

orestis08:07:51

But it’s fricking bonkers :face_with_symbols_on_mouth:

thheller08:07:56

the .default is usually a problem with commonjs VS es6 code

thheller08:07:12

it is madness yes

thheller08:07:47

should be getting better with webpack5 since they are dropping a bunch of those ugly hacks

thheller08:07:57

forcing people to pay more attention when making packages

thheller08:07:24

now webpack just accepts all sorts of crap and as long as it works in webpack people don't pay attention if things are actually correct or not

Chris O’Donnell10:07:19

Thanks. I tried that and found that a bunch more dependencies were downloaded when I compiled. In the cold light of morning it's now obvious that the reason for that is I didn't call clojure with the dev alias. picard-facepalm

orestis11:07:42

Does shadow pick up “nested” node_modules dependencies? (not sure what the right terminology is). Like, node_modules/react-overlays/node_modules/uncontrollable — when there is a top-level node_modules/uncontrollable as well?

thheller11:07:31

no it does not. only top level works

orestis11:07:54

Ah, that’s why I’m having trouble then. There’s version conflicts and apparently that works fine in the npm world.

thheller11:07:16

well it works fine in that you'll have 2 uncontrollable packages included in your build 😉

thheller11:07:37

which is nonsense IMHO 😛

orestis11:07:09

Yeah, and of course uncontrollable released a version 7.0 who’s only change is to break the default exports. Now all the consumers have to change, and of course not everyone has done yet.

orestis11:07:27

I’ll just wait a couple of weeks and try again…

orestis11:07:43

The churn! The churn!

thheller11:07:48

fun times 😛

thheller11:07:00

but yeah stuff like that is gonna get way worse for a while when webpack 5 is released

thheller11:07:22

but its good news for us since then more packages should follow the "strict" packaging that closure expects

orestis11:07:50

Good to know that they’re getting their act together. Now to resist the urge to rewrite all my dependencies…