diesieben07
10/11/2019, 8:19 PMjsMain/resources
, but those files never show up in the NPM project that's generated by the gradle plugin.
Moreover: I am applying the "multiplatform" plugin in a subproject, but the javascript npm projects are still generated in the top level project build folder and there is also an NPM project generated for the top level project (which does not have the multiplatform plugin!). The NPM project that actually contains my js code is put into build/js/packages/<root project name>-<subproject name>
. How can I disable this? I just want a plain NPM project for the javascript code.Ilya Goncharov [JB]
10/12/2019, 8:26 AMprocessedResources
As for your second question, there is some reasons, why we choose this kind of layout. In case of multiple Kotlin/JS modules, there is only one root node_modules
, that are shared betwen all packages without duplication
It is related with how node resolve their modules
We discuss it recently in #javascript
https://kotlinlang.slack.com/archives/C0B8L3U69/p1570548676169100?thread_ts=1570132203.140300&cid=C0B8L3U69snrostov
10/13/2019, 7:46 AMI am unsure as to where I would put my typescript definition files@diesieben07, as @Ilya Goncharov [JB] said it is not supported yet. Please create issue in http://kotl.in/issue
also an NPM project generated for the top level projectIt doesn't. Top-level package.json is not related to any Gradle project. It just contains list of workspaces that located in
build/js/packages
and build/js/packages_imported
. If you will apply kotlin multiplatform or js plugin to root project, corresponding npm package will be created in build/js/packages
, not in build/js
.
How can I disable this? I just want a plain NPM project for the javascript code.We can make special layout for it, but in this cases yarn workspaces and shared npm dependencies will not work for subprojects with this layout. What is your use case? Do you really need it?
diesieben07
10/14/2019, 7:42 AM|_build <- I get an NPM project here! for the root project AND the `mpp` project.
|_build.gradle // plugin multiplatform and jvm with apply false
|___server
|___build.gradle // plugin jvm, depends on :mpp
|___mpp
|___build.gradle // plugin multiplatform
|___src/commonMain/kotlin
|___src/jsMain/kotlin
|___src/jvmMain/kotlin
snrostov
10/14/2019, 7:48 AMpackage.json
. That's why the output of all subprojects are located in the root's project build directory.But what happens is the followingTo be clear: I understand what it happening and it is as designed for the reasons described above. If we put package.json in
mpp/build
, then we can't link mpp
package.json
with other npm projects in your build.diesieben07
10/14/2019, 7:56 AMimport {foo} from "my-project/packages/sub-project"
snrostov
10/14/2019, 7:58 AMdiesieben07
10/14/2019, 7:59 AMsnrostov
10/14/2019, 8:06 AMpackage.json
in the root (not in root/build) with "workspaces": ["build/js/packages/*", "build/js/packages_imported/*", path-to-you-package-here]
. In this way you can just import {foo} from "sub-project"
import {foo} from "sub-project"
will work after manual calling yarn install
in root project dir. yarn will link all packages together, so your path-to-you-package-here
will able to resolve import {foo} from "sub-project"
.diesieben07
10/14/2019, 8:08 AMserver
is a jvm-based server application. mpp
is a multiplatform project that contains the common code (to be shared between the jvm-based server and a typescript frontend).
The typescript frontend should ideally use typescript-friendly build tools (like yarn) and not something like Gradle.snrostov
10/15/2019, 10:58 AMdiesieben07
10/15/2019, 11:58 AM