KotlinJS library sources?


#1

If I have two KotlinJS projects, and one is a library that’s publishing a JAR containing JS to MavenLocal, and the other is an application consuming that library…how do I make it so I can “attach sources” in the application?

The library’s JAR looks like this:

  • library.js
  • library.js.map
  • library.meta.js
  • library/root-package.kjsm

The application can compile just fine against the library, but if I try to Go To Source on the library methods I get the decompiler stub.


#2

To answer my own question…you just publish your Kotlin sources as usual, as documented here, in a *-sources.jar. I had to use sourceSets.main.allSource instead of sourceSets.main.allJava, though, for the sources JAR.