npm-publish: Missing bundled dependencies when using Kotlin 1.5.30+

It seems that Kotlin 1.5.30+ has changed the behaviour regarding the way dependencies are declared in the package.json.

With Kotlin 1.5.21 I see the following behaviour:

  • The package.json inside <root_folder>/build/js/package.json contains a single entry in workspaces with value packages/<project_name-module_name>
  • Then in the <root_folder>/build/js/packages/<project_name-module_name>/package.json there’s indeed all the required npm dependencies using the file:/... format.

In Kotlin 1.5.30+ the behaviour seems to be:

  • The package.json inside <root_folder>/build/js/package.json contains multiple entries each pointing to the dependencies
"workspaces": [
    "packages/<project_name-module_name>",
    "packages_imported/kotlinx-serialization-kotlinx-serialization-json-js-legacy/1.3.0",
    "packages_imported/kotlinx-serialization-kotlinx-serialization-core-js-legacy/1.3.0",
    "packages_imported/kotlin/1.5.31",
    "packages_imported/Kotlin-DateTime-library-kotlinx-datetime-js-legacy/0.2.1",
    "packages_imported/kotlin-test-js-runner/1.5.31",
    "packages_imported/kotlin-test/1.5.31"
  ],
  • Then in the <root_folder>/build/js/packages/<project_name-module_name>/package.json there’s no dependencies at all.

So I guess that the plugin code src/main/kotlin/task/NpmPackageAssembleTask.kt#L107 needs to be adapted to this new 1.5.30+ behaviour

The issue is then that the package.json generated by the plugin does not contain any bundled dependency.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 18 (10 by maintainers)

Most upvoted comments

Well, they mentioned that they are waiting for one bugfix in Kotlin.js and then they will move to IR but I don’t know when that will happen, it’s a bug from 1.4.0. So, if you have the time and resources, I’d gladly appreciate if you could fix it for legacy builds and hopefully over time I could switch to IR.

Hey there @mpetuska I seem to be struggling with the same issue, the bundle is not having dependencies at all, I am using newest kotlin 1.6.20-M1 (because some things in M1 needed that version). You can find the project here: https://github.com/LukasAnda/Transkribe and actual code is on devel branch