Torbilicious
05/31/2018, 12:07 PMEvgeniy Zaharov
05/31/2018, 12:52 PMTorbilicious
05/31/2018, 12:55 PMthrow new Error("Error loading module 'link-lookup-multi-js'. Its dependency 'kotlin' was not found. Please, check whether 'kotlin' is loaded prior to 'link-lookup-multi-js'.");
Error: Error loading module 'link-lookup-multi-js'. Its dependency 'kotlin' was not found. Please, check whether 'kotlin' is loaded prior to 'link-lookup-multi-js'.
Torbilicious
05/31/2018, 12:55 PMEvgeniy Zaharov
05/31/2018, 12:57 PMplugins {
id "com.moowork.node" version "1.2.0"
}
def nodeModules = project.getProjectDir().getPath() + "/node_modules/"
node {
nodeModulesDir = file(nodeModules)
}
task populateNodeModules(type: Copy, dependsOn: [compileKotlin2Js, npmInstall]) {
from compileKotlin2Js.destinationDir
into nodeModules
afterEvaluate {
configurations.testCompile.each {
if (it.absolutePath.endsWith(".jar")) {
from zipTree(it.absolutePath).matching {
include '*.js'
include '*.js.map'
}
}
}
}
}
Torbilicious
05/31/2018, 12:59 PMEvgeniy Zaharov
05/31/2018, 1:00 PMpopulateNodeModules
task and set correctly into
folderVivek
06/01/2018, 1:41 PMbuildscript {
ext.kotlin_version = '1.2.41'
ext.serialization_version = '0.5.0'
repositories {
jcenter()
maven { url "<https://kotlin.bintray.com/kotlinx>" }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlinx:kotlinx-gradle-serialization-plugin:$serialization_version"
}
}
apply plugin: 'kotlin2js'
apply plugin: 'kotlinx-serialization'
repositories {
jcenter()
maven { url "<https://kotlin.bintray.com/kotlinx>" }
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version"
compile "org.jetbrains.kotlinx:kotlinx-serialization-runtime-js:$serialization_version"
}
compileKotlin2Js.kotlinOptions {
outputFile = "${projectDir}/node/index.js"
moduleKind = "commonjs"
sourceMap = true
}
Notice the sourceMap = true
at the bottom, that was essential for the debugger to work transparently.
I also have Delegate IDE build/run actions to gradle
enabled. You can find that option in Build, Execution, Deployment > Build tools > Gradle > Runner
Gradle creates a single JS file that is eventually run. Location of that file is defined in compileKotlin2Js.kotlinOption.outputFile
Evgeniy Zaharov
06/01/2018, 2:26 PM