Fork me on GitHub
#shadow-cljs
<
2020-01-23
>
tbrooke01:01:10

I have a project that uses Winston.js colors.js and moment-mini they all work fine with npm/yarn but under Shadow they all have: required JS dependency "async/series" is not available, it was required by "node_modules/winston/dist/winston/transports/file.js". and the recomendation to run: npm install async/serie When I try to run install it errors out and can’t find the repositories /usr/local/bin/git ls-remote -h -t @github.com/async/series.git it just seems to me that since this is occurring in 3 apparently unrelated instances - except for all using async/series and that it is fine in npm and only shows up in shadow I was thinking it must be trying to do something shadow doesn’t support

Hukka07:01:48

Isn't Winston.js just trying to load the series script from the async package, so you should npm install async itself?

thheller08:01:52

@tbrooke I don't know where you are getting that git command from. that is not how npm works. npm install winston and (require '["winston" :as w]) works absolutely fine for me

thheller08:01:28

the async/series message is a bit wrong. it is the async package which should have been installed when installing winston since it is once of its dependencies

lilactown18:01:00

will js/foo.bar_baz get munged with optimizations?

thheller18:01:18

depends. usually no.

lilactown18:01:53

I don’t get a warning when I turn on externs inference, but it seems to break in release

thheller18:01:51

ie. you have a CLJs namespace starting with foo

lilactown18:01:16

yes, that’s correct

thheller18:01:18

then externs inference backs of and thinks you are in safe land

lilactown19:01:09

what’s the best way to remediate it? other than renaming the global foo

thheller19:01:56

depends. why is it a problem?

thheller19:01:26

the logic why externs inference backs off is that it assumes you are working on JS code that is safe to rename

thheller19:01:41

given that it could be js/cljs.core.assoc or js/goog.string.startsWith

lilactown19:01:49

I have some external JS that sets foo.bar_baz and I need to get foo.bar_baz in some CLJS code

thheller19:01:24

that seems like a problem on its own given that it clashes with the CLJS namespace structure?

lilactown19:01:30

yeah, not ideal. code was written before my time

lilactown19:01:57

I guess I’ll do gobj/get for now until I can refactor this

darwin20:01:44

shadow-cljs just blew my mind, I switched my new project to release compilation and expected an evening full of pain and it worked out-of-the-box on first try!!! note that the project uses some non-trivial npm deps and also lazy loading of modules @thheller kudos!