https://kotlinlang.org logo
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
javascript
  • p

    Pepijn de Vos

    05/13/2021, 5:58 PM
    Currently:
    @file:JsModule("react-plotly.js")
    @file:JsNonModule
    
    import react.*
    
    @JsName("Plot")
    external val reactPlot: RClass<dynamic>
    But getting:
    Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
    
    Check the render method of `Welcome`.
        in Welcome react.development.js:315
        React 3
        child_5 sampleproject.js:20925
        child_6 sampleproject.js:20931
        invoke_100 sampleproject.js:20934
        render_0 sampleproject.js:25196
        invoke_103 sampleproject.js:21108
        factory_40 sampleproject.js:21164
        buildElements sampleproject.js:21020
        render_1 sampleproject.js:21129
        render sampleproject.js:21132
        React 13
        render_0 sampleproject.js:24780
        render$default sampleproject.js:24785
        invoke_129 sampleproject.js:25057
        factory_45 sampleproject.js:25070
        (Async: EventHandlerNonNull)
        main sampleproject.js:25010
        <anonymous> sampleproject.js:25508
        <anonymous> sampleproject.js:3
        <anonymous> sampleproject.js:15
        <anonymous> sampleproject.js:25490
        js sampleproject.js:707
        __webpack_require__ sampleproject.js:30
        0 sampleproject.js:719
        __webpack_require__ sampleproject.js:30
        <anonymous> sampleproject.js:94
        <anonymous> sampleproject.js:97
        webpackUniversalModuleDefinition sampleproject.js:9
        <anonymous> sampleproject.js:10
    t
    • 2
    • 19
  • b

    Bradleycorn

    05/14/2021, 7:30 PM
    Hey all … I posted this in #multiplatform but got no response. Hopefully someone here can help me with this javascript issue: I’ve created a new multiplatform project that creates a library and one of its targets is javascript. I’m trying to produce a package that I can publish to an npm registry. Everything complies OK, but the output for the js target seems …. odd.  The produced 
    package.json
     files have a few problems: 1. they have dependencies with “hardcoded” absolute file paths, like:  
    "kotlin": "file:/Users/brad.ball/dev/multiplatform/new/wager-utils/build/js/packages_imported/kotlin/1.5.0",
    2. the dependencies list contains entries for 
    kotlin-test-js-runner
     and 
    kotlin-test
     . Why would those be dependencies for a published package? Seems like at best they should be devDependencies. With the hard coded file paths, you can’t really publish the package or use it anywhere but on the machine where it was generated… The full package.json output is included in the replies thread… Am I doing something wrong? I have a pretty standard gradle config, haven’t really changed much from what was produced by IntelliJ when creating the project. (edited)
    t
    • 2
    • 26
  • j

    Jonathan Smith

    05/14/2021, 9:48 PM
    Editing a Kotlin/JS project, suddenly ran out of memory. Killed IDEA. Now when I try to re-load the project I get “Preparing workspace...” and the whole thing hangs. (Someone else reported the same issue before I did.) https://youtrack.jetbrains.com/issue/IDEA-269204 It looks like JetBrains recommends falling back to a 1.4 Kotlin in the IDE. Not sure how to do that since I can’t open the project .. but I will look around. Any advice? Thanks!
    t
    • 2
    • 5
  • r

    Rob Elliot

    05/15/2021, 9:42 AM
    I’ve seen a few people wanting to compile Kotlin to node citing AWS cold start times - this article suggests there’s not much between node and JVM cold starts: https://mikhail.io/serverless/coldstarts/aws/ Do people have different experiences?
    r
    s
    • 3
    • 5
  • d

    dwursteisen

    05/15/2021, 10:37 AM
    👋 I'm trying to understand Kotlin/JS and how module system is working. I didn't succeed to do what I want. • I have a gradle kotlin multiplatform configured to produce some javascript using only the browser configuration.
    mpp.js {
           this.browser {
                         this.webpackTask {
                         this.compilation.kotlinOptions {
                         this.sourceMap = true
                         this.sourceMapEmbedSources = "always"
                         this.freeCompilerArgs += listOf("-Xopt-in=kotlin.ExperimentalStdlibApi")
                   }
               }
         }
        this.binaries.executable()
    }
    • I'm trying to expose one method of my kotlin code and using it in my webpage.
    package my.module
    @JsExport fun startCube() { // ... }
    • I'm trying to import this module from my
    index.html
    . And it's not working 🤔
    <script type="module">
        import './my-module.js'; // the path is correct
    </script>
    • I got this error message :
    Uncaught TypeError: Cannot set property 'my-module.js' of undefined
        at webpackUniversalModuleDefinition (minigdx-docs.js:9)
    • By looking at the code, I see that the module UMD "module system" try to start and load the module but failed to do so:
    root["my-module"] = factory(); // root is undefined
    • I look in the Kotlin/JS documentation and how javascript module is working but I failed to understand what's wrong 🤔 (I far to be at ease in the javascript ecosystem) • &TLDR: Do you have any advise, example to load a kotlin js module from a browser?
    t
    • 2
    • 4
  • b

    Bas Verlooy

    05/18/2021, 10:02 AM
    Hi all, what is the best approach for integrating https://github.com/visjs/vis-network into my kotlin/react project, it has https://github.com/visjs/vis-network/tree/master/types d.ts files inside here. Should I copy all these files and run Dukat on that and continue from that point?
    t
    • 2
    • 18
  • s

    Slackbot

    05/18/2021, 10:50 AM
    This message was deleted.
    u
    • 2
    • 1
  • a

    Andrey Ivanov

    05/18/2021, 12:05 PM
    I divided the project into subprojects, I am trying to implement lazy loading, I described the import function like this:
    external fun <T> import(path: String): Promise<T>
    or
    external fun <dynamic> import(path: String): Promise<dynamic>
    I try to use like this:
    val SomePage = rLazy<dynamic> {
        { import<dynamic>("./somePage.js") }
    }
    I get the error: Type mismatch. Required: RClass<TypeVariable(P)> Found: () → Promise<dynamic> Why? I don't understand by the signature, I give him a lambda and he sees a promise inside the lambda.
    t
    • 2
    • 2
  • j

    jmfayard

    05/18/2021, 1:51 PM
    Hello friends, Javascript newbie here. My command-line tool worked fine under Node.js with
    ./gradlew jsNodeRun
    Any pointers on how I could publish it on npmjs.org so that people can install it with
    $ npm install -g kotlin-cli-starter
    https://github.com/jmfayard/kotlin-cli-starter
    b
    • 2
    • 7
  • i

    Ian Alexander

    05/18/2021, 10:22 PM
    Hey folks, I'm looking to integrate Kotlin/JS into an existing KMM project and just doing some experimenting here before diving in, but running into some issues as all samples are based around the web project being built with kotlin. Instead we want to set it up that the web project knows nothing about kotlin, the web project just imports a javascript package that happens to contain all the shared application code. In Andorid/iOS the common code portion spits out as an android lib/xcode framework. I've got as far as generating a javascript module (using Kotlin/JS IR) but am stuck with this error - and a lack of knowledge of the JS ecosystem:
    Cannot find module 'shared' or its corresponding type declarations.
    The module is imported to the web project with
    "shared": "file:../build/js/packages/shared"
    and into the javascript file with
    import { Platform } from 'shared';
    Any idea where I may be going wrong?
    r
    • 2
    • 3
  • a

    Aleksandar Milojević

    05/20/2021, 6:24 AM
    Dear all, I am trying to import files generated from multiplatform basic project into e.g. Visual Code Studio. First of all, I am completely newbie in JS, so please, be kind 🙂 I have simple class with only one helloWorld() function as below
    import kotlin.js.JsExport
    
    @JsExport
    fun helloWorld(): String {
        return "Hello World"
    }
    setup in build.gradle.kts is
    js(IR) {
            browser {
            }
            binaries.executable()
        }
    After importation generated files in VCS, my kotlin function is not visible (Uncaught ReferenceError: helloWorld is not defined) and generated files are
    t
    • 2
    • 2
  • h

    Hywel Bennett

    05/20/2021, 10:08 AM
    Can anyone help me to understand the Kotlin JS plugin? I understand it installs NPM and uses yarn to download dependencies. Are there any local caches generated as part of the build? If so, where are they, or is there a gradle job that cleans these? The reason for asking is that my node_modules ends up with a corrupted dependency (@icons/material) and I'm guessing it's coming from a local cache but gradle clean isn't fixing it and that's all I can guess.
    r
    • 2
    • 3
  • t

    Tomas Kormanak

    05/20/2021, 11:28 AM
    Hi, I am trying to import module in kotlinJs
    @JsModule("botui")
    external class BotUI(name: String) {}
    val bot = BotUI("test")
    and I am getting error
    $module.$botui is not a constructor
    botui module exports only one class as a default. Should I use different approach when module has only default export?
    t
    • 2
    • 6
  • r

    Robert Jaros

    05/20/2021, 1:41 PM
    Are there any changes in RegEx implementation in Kotlin/JS 1.5.0? After upgrade from 1.4 to 1.5 I have an error like this
    Uncaught SyntaxError: raw bracket is not allowed in regular expression with unicode flag
    in
    kotlin.js:44848
    probably with this code:
    fun validateEmail(value: String): Boolean {
        return value.matches("^([a-zA-Z0-9\\-_.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z\\-0-9]{2,}))$".toRegex())
    }
    😕 1
    s
    • 2
    • 5
  • i

    Ilya Kalibrov [JB]

    05/20/2021, 3:42 PM
    ❗Hi, folks! Few months ago @Sebastian Aigner wrote an article about migrating from Legacy BE to IR. He described all major cases/issues which can be faced during the migration, but I’m gathering additional information on things that need to be done for successful migration. If you have such cases in your projects - leave a comment in thread with general description/sample/Youtrack ticket or write me direct message :thread-please: Your cases will help us to improve the experience of a migration. More cases will be covered - more comfortable this process will be! In advance, thank’s everyone for the response!
    🔥 2
    a
    a
    s
    • 4
    • 4
  • e

    Ethan Davidson

    05/20/2021, 8:26 PM
    I made a demo that shows how to use webworkers in Kotlin/JS: https://github.com/ethanmdavidson/KotlinJSWebWorkerDemo It involves building multiple .js files, which is also something I've seen people asking about. Check it out and let me know what you think!
    🔥 2
    t
    • 2
    • 4
  • v

    Vincent Le

    05/20/2021, 8:58 PM
    Wanted to share some resources for getting Tailwind CSS working in a Kotlin/JS (really, MPP) project. I was working on this over the past month and it was surprisingly hard (not many resources online and I’m new to this whole stack). • Getting things working for development: https://github.com/nanodeath/kotlinjs-tailwindcss • Expanding on above to optimize for production: https://vple.me/posts/purging-tailwindcss-with-kotlinjs/ And for completeness, an earlier thread: https://kotlinlang.slack.com/archives/C0B8L3U69/p1600892124011900
    :party-parrot: 1
    👏 4
    👍 3
    🎉 1
    d
    • 2
    • 2
  • b

    Big Chungus

    05/23/2021, 9:07 PM
    How do I import side-effects in kotlin? Something like
    import "some/side/effect.js
    in javascript?
    t
    • 2
    • 9
  • t

    Tarun Chawla

    05/24/2021, 6:53 AM
    I have a Full stack project on kotlin multiplatform. One is jvm and other is js. jvm compiling is faster but js one is very slow. Any tips to fasten the compiling of kotlin/js codebase?
    r
    a
    • 3
    • 9
  • d

    Darren Bell

    05/24/2021, 9:29 AM
    Hi. Does anyone have a working example of using Kotlin JS to create an Azure Function? I assume it has to be built locally and then published. But I'm not sure how to structure the js to meet the following requirements: https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-node?tabs=v2#configure-function-entry-point. Thanks for any help/guidance
    b
    • 2
    • 3
  • m

    MrPowerGamerBR

    05/24/2021, 1:31 PM
    I'm facing a very odd issue where upgrading from 1.4.32 to 1.5.0 breaks my Kotlin/JS project, it compiles without any issues but the code fails because "CancelledException" (a typealias in Ktor) is not present. This issue is also present in a development webpack so I don't think it is a DCE issue. (Legacy compiler)
    👀 1
    t
    • 2
    • 11
  • r

    Rob Murdock

    05/24/2021, 3:29 PM
    Does anybody have experience making a Kotlin JS+IR share “resources” with a downstream Kotlin JS+IR project? Trying to clean something up here and any clues could be useful
    b
    t
    • 3
    • 29
  • d

    Deactivated User

    05/25/2021, 9:44 AM
    Hey guys, is it known that
    jsBrowserProductionWebpack
    gradle task doesn't update the distributions js file sometimes when in watch mode
    -t
    ?
    c
    • 2
    • 3
  • r

    Robert Jaros

    05/25/2021, 11:20 AM
    My Kotlin/JS projects don't work after upgrade from Kotlin 1.5.0 to Kotlin 1.5.10 because
    build.gradle.kts
    doesn't compile. What happened?
    c
    r
    t
    • 4
    • 23
  • t

    Tomas Kormanak

    05/26/2021, 8:55 AM
    Hi, all our builds have started failing with:
    REAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
    This is no longer the case. Verify if you need this module and configure a polyfill for it.
    I think I understand the issue itself, but I don't get why it started this morning (yesterday builds were ok, we upgraded to Kotlin 1.5.0 and webpack 5 couple weeks ago) Any idea?
    t
    a
    • 3
    • 4
  • w

    willyrs

    05/28/2021, 10:58 AM
    Is there a way to split in chunks the generated js file? I've this config
    js("js", IR) {
            browser()
            binaries.executable()
            useCommonJs()
        }
    and I'm using compileProductionExecutableKotlinJs to create the .js and d.ts that I copy to a typescript react project, but the js is super large (near 4mb)
    t
    • 2
    • 17
  • b

    Big Chungus

    05/29/2021, 2:37 AM
    Any ETA on getting https://github.com/Kotlin/kotlinx-nodejs out of jcenter?
    t
    • 2
    • 1
  • s

    Shabinder Singh

    05/30/2021, 11:19 AM
    Need Help Guys (Regex) : I have a regex and it works as expected in All Platforms except Kotlin/JS REGEX:
    """ytInitialPlayerResponse\s*=\s*(\{.+?\})\;var meta""".toRegex()
    *ERROR*(only in Kotlin/JS):
    SyntaxError: Invalid regular expression: /ytInitialPlayerResponse\s*=\s*(\{.+?\})\;var meta/: *Invalid escape*
    at <global>.new RegExp(<anonymous>)
    However this same regex works fine online in a Regex Editor/Tester , link: https://regex101.com/r/WZT1Pr/1/ Any Help would be Appreciated!
    r
    e
    v
    • 4
    • 16
  • r

    Robert Munro

    05/31/2021, 10:37 AM
    hiya, I am a very new to kotlinJS and have a question regarding transporting casting objects sent over http - from the server i send a Response
    @Serializable
    data class ResponseDomain constructor(
        val payload: List<Domain> = listOf(),
        val errors: List<ErrorDomain> = listOf()
    )
    where domain is a kotlin interface that all the domain data obects implement and they are serialized using kotlin serialization(polymorphic) In my frontend I fetch the url like so:
    val response = window
        .fetch("$BASE_URL/playlists")
        .await()
        .json()
        .await()
    which has a payload of List<PlaylistDomain>
    @Serializable
    data class PlaylistDomain constructor(
        val id: Long? = null,
        val title: String,
        val items: List<PlaylistItemDomain> = listOf(),
        ...
    ) : Domain
    but casting back to ResponseDomain fails
    (response as ResponseDomain)
    with and
    Illegal cast
    error should i just send the response as text/plain (not application/json) and use kotlin deserialisation to get a ResponseDomain? seems like since the browser parses my json to json object i seem to not be able to cast to my kotlin object type - obvs i dont want to map the whole thing from json to domain manually but in the kotlin js tutorial (the video browser one) they map the response as a cast (
    response as Video
    ). maybe it only works for simple objects?
    r
    • 2
    • 2
  • r

    Robert Munro

    06/01/2021, 8:42 AM
    im having some issues setting up github actions to build my kotlinJS project? i have the js runtime dependency:
    implementation(npm("kotlinx-serialization-kotlinx-serialization-core-jslegacy", "1.4.2-RC1"))
    and i get error:
    Module 'kotlinx-serialization-kotlinx-serialization-core-jsLegacy' not found
    > Task :remote:jsBrowserDevelopmentWebpack
    do i have to install npm or something to make this work on github actions? or is there some github action i need to use to build kotlinJS on github actions? this is my github actions yaml - the js lib is built and copied to a jar as a resource https://github.com/sentinelweb/cuer/blob/ab00c7a7cd969eafa72b0d28bc5ba5c5c3e099d3/.github/workflows/android.yml
    t
    • 2
    • 10
Powered by Linen
Title
r

Robert Munro

06/01/2021, 8:42 AM
im having some issues setting up github actions to build my kotlinJS project? i have the js runtime dependency:
implementation(npm("kotlinx-serialization-kotlinx-serialization-core-jslegacy", "1.4.2-RC1"))
and i get error:
Module 'kotlinx-serialization-kotlinx-serialization-core-jsLegacy' not found
> Task :remote:jsBrowserDevelopmentWebpack
do i have to install npm or something to make this work on github actions? or is there some github action i need to use to build kotlinJS on github actions? this is my github actions yaml - the js lib is built and copied to a jar as a resource https://github.com/sentinelweb/cuer/blob/ab00c7a7cd969eafa72b0d28bc5ba5c5c3e099d3/.github/workflows/android.yml
t

turansky

06/01/2021, 9:04 AM
Standard runtime declaration
r

Robert Munro

06/01/2021, 9:15 AM
weird ... it seems that i need to add this npm dependency in
jsMain
implementation(npm("kotlinx-serialization-kotlinx-serialization-core-jslegacy", "1.4.2-RC1"))
without it i get an eror on the page saying the lib is missing. or similar fail for webpack as above. or should i add you plugin declaration?
t

turansky

06/01/2021, 9:44 AM
serialization-core.js
located inside runtime jar
r

Robert Munro

06/01/2021, 9:46 AM
yes it looks like it should be so i must have someething configured incorrectly
i have
val commonMain by getting {
    dependencies {
        implementation(project(":shared"))
        implementation("org.jetbrains.kotlinx:kotlinx-datetime:$ver_kotlinx_datetime")
        implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:$ver_kotlinx_serialization_core")
        implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:$ver_kotlinx_serialization_core")
        implementation("io.ktor:ktor-client-core:$ver_ktor")
        implementation("io.insert-koin:koin-core:$ver_koin")
    }
}
and
val jsMain by getting {
    dependencies {
        implementation(npm("kotlinx-serialization-kotlinx-serialization-core-jslegacy", "1.4.2-RC1"))
        implementation("org.jetbrains.kotlinx:kotlinx-datetime-js:$ver_kotlinx_datetime")
        implementation("org.jetbrains:kotlin-react:17.0.1-pre.148-kotlin-1.4.21")
        implementation("org.jetbrains:kotlin-react-dom:17.0.1-pre.148-kotlin-1.4.21")
        implementation(npm("react", "17.0.1"))
        implementation(npm("react-dom", "17.0.1"))
        implementation("org.jetbrains:kotlin-styled:5.2.1-pre.148-kotlin-1.4.21")
        implementation(npm("styled-components", "~5.2.1"))
        implementation(npm("react-youtube-lite", "1.0.1"))
        implementation(npm("react-share", "~4.2.1"))
        implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.3")

    }
}
if i drop the js legacy - it all breaks
at runtime/webpack
t

turansky

06/01/2021, 1:25 PM
1. Following dependencies are redundant:
implementation(npm("react", "17.0.1"))
implementation(npm("react-dom", "17.0.1"))
implementation(npm("styled-components", "~5.2.1"))
2. Check which package require
kotlinx-serialization-kotlinx-serialization-core-jslegacy
(version
1.4.2-RC1
is invalid)
r

Robert Munro

06/02/2021, 8:30 AM
yeah so i removed react, react-dom and styled-components but still the dependency is needed - I'm unsure why this jsLegacy breaks in my Ci build tho.
View count: 3