Я запустил библиотеку Kotlin / JS реагировать на плагин kotlin Gradle. У меня следующая ошибка:
> Task :web:webpack-bundle FAILED
js/kotlinx-html-js.js
Module not found: Error: Can't resolve 'kotlin' in '/home/marcin/Projects/EduKotlinAcademy/web/build/node_modules_imported/kotlinx-html-js'
@ ../node_modules_imported/kotlinx-html-js/kotlinx-html-js.js 3:4-42
@ ../node_modules_imported/kotlin-react-dom/kotlin-react-dom.js
@ ./web.js
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':web:webpack-bundle'.
> node webpack.js failed (exit code = 2)
Похоже, что зависимость от Kotlin не может быть найдена в kotlinx-html-js. Хотя я определяю Kotlin и это должно быть сгенерировано нормально.
Для этой конфигурации:
group "org.kotlinacademy" version "1.0-SNAPSHOT"
apply plugin: 'kotlin2js'
apply plugin: 'org.jetbrains.kotlin.frontend'
repositories {
jcenter()
}
kotlinFrontend {
npm {
dependency("webpack-cli", "v2.0.12")
dependency("react", "15.6.1")
dependency("react-dom", "15.6.1")
dependency("react-router-dom", "4.2.2")
dependency("jquery")
dependency("react-markdown")
}
sourceMaps = true
webpackBundle {
bundleName = "main"
contentPath = file('src/main/web')
proxyUrl = "http://localhost:8090"
}
}
dependencies {
compile project(':common-js')
compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version"
compile "org.jetbrains.kotlinx:kotlinx-coroutines-core-js:0.22.5"
compile("org.jetbrains.kotlinx:kotlinx-html-js:0.6.10") { force = true }
compile 'org.jetbrains:kotlin-react:16.3.1-pre.27-kotlin-1.2.30'
compile "org.jetbrains:kotlin-react-dom:16.3.1-pre.27-kotlin-1.2.30"
}
compileKotlin2Js {
kotlinOptions.metaInfo = true
kotlinOptions.outputFile = "$project.buildDir.path/js/${project.name}.js"
kotlinOptions.sourceMap = true
kotlinOptions.moduleKind = 'commonjs'
kotlinOptions.main = "call" }