Is it somehow possible to use a gradle (sub) proje...
# gradle
h
Is it somehow possible to use a gradle (sub) project as npm dependency?
a
you mean using the
npm()
syntax, like this?
Copy code
kotlin {
  sourceSets {
    jsMain {
      dependencies {
        implementation(npm("libpcre2x", "1.2.3"))
      }
    }
  }
}
because you can pass a file, instead of the version
Copy code
implementation(npm("libpcre2x", file("local_node_modules/libpcre2x")))
so you’d just need some jiggery pokery to fetch the JS module from the other subproject
h
Yes. But instead referencing to a file, I want to use a Gradle project dependency, because Gradle needs to build the project first. Otherwise the package json file isn't found during fetching dependencies.
But I think, this needs to be implemented in the KGP plugin.
a
would you expect a difference between using
npm()
and just adding a regular dependency, like this?
Copy code
implementation(project(":some-other-subproject))
h
Yes, the normal implementation adds the subproject as source dependency, but I want to add it as a npm dependency and use the npm package with
external
.