https://kotlinlang.org logo
#javascript
Title
# javascript
a

Arkadii Ivanov

06/28/2022, 9:55 PM
When distributing a
library
that depends on e.g.
org.jetbrains.kotlin-wrappers:kotlin-react-dom
, is there are way to automatically populate transitive NPM dependencies in
package.json
? So that I can avoid adding
implementation(npm("react-dom", "*"))
explicitly.
b

Big Chungus

06/28/2022, 10:42 PM
npm-publish plugin used to do that in early versions but then I dropped it when binaries.library came along as it was not needed anymore. However I kinda assumed that transitive npm dependencies would get propagated into pjson... Looks like I'll need to bring that feature back tomorrow
🎉 2
a

Arkadii Ivanov

06/28/2022, 11:02 PM
My use case is, after running
browserProductionLibraryDistribution
I need to
webpack
the output. I need all transitive NPM dependencies to be present in
package.json
. Currently I'm adding them manually, which is error prone. It's also not straight forward as I need to guess what Kotlin wrapper belongs to what NPM module (or multiple modules). E.g. it's not clear what NPM module(s) should I add if I use
kotlin-emotion
.
b

Big Chungus

06/28/2022, 11:08 PM
I'm aware 😀
Although to be honest this sounds like a missing feature in kjs plugin. Without it a lot of library binaries are simply invalid...
@Ilya Goncharov [JB] any particular reason why binaries.library does not hoist transitive npm dependencies from kjs dependencies?
a

andylamax

06/29/2022, 1:02 AM
I am also currently doing this. Adding npm dependencies all by myself on the final libary. For me, I am lucky all I need to do is add react, platform and joda-time, but I know it can explode with just a single extra add on
i

Ilya Goncharov [JB]

06/29/2022, 6:23 AM
No, this is more bug than intentional behaviour And that’s one of reasons why we do not announce this feature 🙂
b

Big Chungus

06/29/2022, 7:19 AM
Ah, awesome. I'll raise a pr to kgp then
👍 1
Any existing tracker issue for this or shall I open one?
a

andylamax

06/29/2022, 7:43 AM
upvoted faster than the flash
😄 2
b

Big Chungus

06/29/2022, 11:54 AM