Hi fellows! I’m struggling to make a multiplatform...
# multiplatform
e
Hi fellows! I’m struggling to make a multiplatform app in which the webApp should be made with Kotlin + React. So far I’ve been able to make it work with kotlin2js but I cannot even get the dependencies right to start writing juicy reactive code. Which dependencies should I use write Kotlin in a ReactJS fashion - or viceversa?
This is my build gradle so far:
Copy code
buildscript {
    repositories {
        jcenter()
        maven {
            url "<https://dl.bintray.com/kotlin/kotlin-eap>"
        }
        maven {
            url "<http://dl.bintray.com/kotlin/kotlinx.html/>"
        }
    }

    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-frontend-plugin:0.0.45"
    }
}

apply plugin: 'kotlin-platform-js'
apply plugin: 'kotlin2js'
apply plugin: 'kotlin-dce-js'
apply plugin: 'org.jetbrains.kotlin.frontend'

repositories {
    mavenCentral()
    jcenter()
    maven {
        url "<http://dl.bintray.com/kotlin/kotlinx.html/>"
    }
}

dependencies {
    expectedBy project(":shared")
    implementation "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version"
    implementation 'org.jetbrains.kotlinx:kotlinx-html-js:0.6.2'
}

kotlinFrontend {

    sourceMaps = true

    downloadNodeJsVersion = 'latest'

    npm {
        dependency("react")
        dependency("react-dom")
        dependency("react-markdown")
    }

    webpackBundle {
        bundleName = "main"
        contentPath = file('src/main/web')
        mode = "development"
        //mode = "production"
    }
}

compileKotlin2Js {
    kotlinOptions.metaInfo = true
    kotlinOptions.outputFile = "$project.buildDir.path/js/${project.name}.js"
    kotlinOptions.sourceMap = true
    kotlinOptions.moduleKind = 'commonjs'
    kotlinOptions.main = "call"
}

compileTestKotlin2Js {
    kotlinOptions.metaInfo = true
    kotlinOptions.outputFile = "$project.buildDir.path/js-tests/${project.name}-tests.js"
    kotlinOptions.sourceMap = true
    kotlinOptions.moduleKind = 'commonjs'
//    kotlinOptions.moduleName = project.name + "-test"
    kotlinOptions.main = "call"
}
f
Hi, i hope this helps you, i used Kotlin React in my multiplatform project, take a look at https://github.com/Foso/Sheasy/blob/develop/web/build.gradle
t
e
Thanks guys! In fact this implementation dependencies from spikes’ build.gradle was my missing puzzle piece glitch crab
💯 1