gpt4 book ai didi

kotlin - intelliJ在哪里将kotlin.js放在多平台项目中

转载 作者:行者123 更新时间:2023-12-02 12:43:40 26 4
gpt4 key购买 nike

使用IntelliJ创建多平台项目时,似乎没有像创建js项目那样创建kotlin.js(std库)。

最佳答案

如文档where the kotlin.js is mentioned中所述:

Note: ... In a Maven or Gradle build, no library files are copied by default to the compilation output directory, see the corresponding tutorials for the instructions.



Kotlin Multiplatform项目构建始终与Gradle一起运行,并且您需要引用 Gradle tutorial,它表示:

By default, Gradle does not expand the JARs in the build process, so we need to add an additional step in our build to do so:

task assembleWeb(type: Sync) {
configurations.compile.each { File file ->
from(zipTree(file.absolutePath), {
includeEmptyDirs = false
include { fileTreeElement ->
def path = fileTreeElement.path
path.endsWith(".js") && (path.startsWith("META-INF/resources/") ||
!path.startsWith("META-INF/"))
}
})
}
from compileKotlin2Js.destinationDir
into "${projectDir}/web"

dependsOn classes
}

assemble.dependsOn assembleWeb

This task copies both dependencies runtime files and the compilation output to the web directory.

关于kotlin - intelliJ在哪里将kotlin.js放在多平台项目中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46915905/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com