When distributing a `library` that depends on e.g....
# javascript
a
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
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
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
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
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
No, this is more bug than intentional behaviour And that’s one of reasons why we do not announce this feature 🙂
b
Ah, awesome. I'll raise a pr to kgp then
👍 1
Any existing tracker issue for this or shall I open one?
a
upvoted faster than the flash
😄 2
b