Reputation: 1973
When using IntelliJ to create a Multiplatform Project, it doesn't seem to create kotlin.js (the std lib) like it does for a js project.
Upvotes: 2
Views: 400
Reputation: 148169
As said in the docs 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.
The Kotlin Multiplatform project builds are always run with Gradle, and you need to refer to the Gradle tutorial, which says:
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.
Upvotes: 3