https://kotlinlang.org logo
Docs
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
  • r

    Robert Jaros

    03/23/2020, 1:58 PM
    Will IR backed be the default in the final 1.4 release?
    b
    • 2
    • 6
  • t

    turansky

    03/23/2020, 2:07 PM
    2+ output
    .js
    files for one Gradle submodule? Possible with webpack plugin.
    Extension configuration
    b
    • 2
    • 1
  • a

    araqnid

    03/23/2020, 8:57 PM
    org.jetbrains:kotlin-extensions:1.0.1-pre.93-kotlin-1.4-M1 depends on org.jetbrains.kotlinx:kotlinx-html-js:0.7.1-build-1707 which doesn’t seem to be published — the “try 1.4-M1” post says there are issues with the wrappers in the new JS backend, but was this an expected outcome?
    s
    b
    • 3
    • 6
  • j

    Jared Woolston

    03/23/2020, 9:24 PM
    I am attempting to use an NPM dependency from the JS portion of an MPP project. Specifically, I am trying to construct an object of a class from the NPM. Specifically, the nvk NPM. I have added a file,
    nvk.kt
    which contains:
    @file:JsModule("nvk")
    @file:JsNonModule
    package nvk
    
    external class VulkanWindow
    And in the JS source set, I am trying to define an
    actual
    for an
    expected
    as seen here:
    actual class VkWindow {
    
        val window: VulkanWindow
    
        actual constructor(width: Int, height: Int, title: String) {
            window = VulkanWindow::class.js.createInstance()
            window.asDynamic()["width"] = width
            window.asDynamic()["height"] = height
            window.asDynamic()["title"] = title
        }
    }
    Where
    createInstance()
    is defined following the discussion at https://discuss.kotlinlang.org/t/is-there-a-way-to-use-the-new-operator-with-arguments-on-a-dynamic-variable-in-kotlin-javascript/6126/4 as:
    fun <T : Any> JsClass<T>.createInstance(vararg args: dynamic): T {
        @Suppress("UNUSED_VARIABLE")
        val ctor = this
    
        @Suppress("UNUSED_VARIABLE")
        val argsArray = (listOf(null) + args).toTypedArray()
    
        //language=JavaScript 1.6
        return js("new (Function.prototype.bind.apply(ctor, argsArray))").unsafeCast<T>()
    }
    This all compiles fine but when I try and run it via
    jsNodeRun
    I get the following error:
    return js("new (Function.prototype.bind.apply(ctor, argsArray))").unsafeCast<T>()
    ^
    Error: Argument 1 must be of type 'Object'
    To be honest, I don't have a particular preference on how I instantiate objects from this module, though I would like to be able to eventually do it with arguments. Any guidance would be greatly appreciated.
    t
    d
    • 3
    • 5
  • i

    Ian Stewart

    03/24/2020, 7:25 PM
    Hey @bashor, congrats on the 1.4-m1 release. I'm very excited to see this, in particular the typescript output. I've been using ntrrgc's tool for ts, it will be great to have full classes generated! I'm not sure if I am set up correctly, though. I'm trying to do a multiplatform project, and the release docs say to annotate your classes with @JsExport. When I use this in my common code all of my other targets fail, (jvm, ios, ...) Even when using multiplatform with just js, it fails with the same error for the compileKotlinMetadata task. Am I missing an incantation?
    :tnx: 1
    t
    b
    • 3
    • 21
  • d

    dazza5000

    03/24/2020, 9:53 PM
    wait - how do we get typescript definitions generated now? that would be awesome for the team i integrate with
    i
    i
    s
    • 4
    • 5
  • j

    Jurriaan Mous

    03/25/2020, 5:02 PM
    I use some nodejs code (like
    Crypto.randomBytes(16)
    and
    Buffer.from("AQ", "base64")
    in actual implementations of multiplatform code I intended to replace with browser compatible code. Somehow if I run my tests in the browser, the node functions all work and tests succeed in all browsers. (Firefox/Safari/Chrome) How can this be explained? Can I expect these functions to run in a proper application? Or am I overlooking something?
    b
    • 2
    • 6
  • m

    Marian Schubert

    03/25/2020, 5:13 PM
    I'm trying
    1.4-M1
    but
    ./gradlew run
    no longer exists. What should I use instead?
    t
    i
    b
    • 4
    • 20
  • r

    Rob Murdock

    03/25/2020, 5:21 PM
    Recently switched to using the kotlin plugin’s webpack rather than my own custom configuration, and I’ve been running into this issue in about 50% of my builds: During the kotlinNpmInstall task, sometimes when a library runs its postinstall scripts, they return errors along the lines of
    Exit code: 127
    Command: node scripts/build-browser-scripts
    Arguments: 
    Directory: /home/circleci/project/build/js/node_modules/wd
    Output:
    /bin/sh: 1: node: not found
    ...
    * What went wrong:
    Execution failed for task ':kotlinNpmInstall'.
    >                 Process 'Resolving NPM dependencies using yarn' returns 127
    Fun right? It doesn’t always happen on the same postinstall script. I’m pretty sure node is installed on the docker image (though it shouldn’t be using that version - it should use the version the kotlin plugin downloads). It doesn’t seem to be affected by running kotlinNodeJsSetup in a previous gradle run. Any clues would be useful… this is blocking me from fully utilizing the power of the plugin. 😰
    i
    b
    i
    • 4
    • 11
  • s

    Stefan Beyer

    03/26/2020, 10:34 AM
    Hi 🙂 I have run into an issue while trying out KotlinJs 1.4-M1 with the new IR compiler backend and gradle 6.3: It seems that there is a lingering java process that keeps open file handles to the compiler output, (like
    bodies.knb
    ) preventing any subsequent builds from touching the files. When I search for the process that has the file handles and kill it manually, I can build the project one more time. But after that, there is a new process that locks the files again. I made a minimal example project to demonstrate this: https://github.com/LostMekka/kotlin-js-1.4-M1-error-demonstration. Is anyone else having this issue?
    i
    • 2
    • 2
  • s

    Sebastian Aigner

    03/27/2020, 2:09 PM
    🎉 More good news for everyone wanting to try Kotlin 1.4-M1 with the new IR compiler! 🎉 Artifacts for kotlin-react and for ktor-clients are now available with IR artifacts! For
    ktor-client-core
    and
    ktor-client-js
    , version
    1.3.2-1.4-M1-2
    adds IR support. For
    kotlin-react
    and
    kotlin-react-dom
    , version
    16.13.0-pre.93-kotlin-1.4-M1
    adds IR support. Please note that especially the react wrappers heavily relied on specific characteristics of the default backend, which might make your current code incompatible with the new IR backend. The issues we’ve already identified are: - Interfaces implementing
    RProps
    or
    RState
    should be marked as
    external interface
    . Otherwise, you will get a
    Uncaught ClassCastException
    . If you’re implementing these interfaces via a
    class
    , you can mark it as
    @JsExport
    – however, we suggest evaluating if you could use an
    external interface
    instead. - To make your components work in
    production
    mode, please mark your
    RComponent
    implementations with
    @JSExport
    . Otherwise, you might run into issues such as
    TypeError: l.render is not a function (react-dom.production.min.js:182)
    If you’d like to see how we migrated the kotlin-full-stack-application-demo to IR, check the diff of our
    1.4
    branch: https://github.com/Kotlin/kotlin-full-stack-application-demo/compare/1.4 Of course, we know that this is far from ideal. The team is having a close look at these cases, and any other issues you might report, and will try their best to improve and polish the developer experience over time. Solutions currently being evaluated include compiler checks, IDE inspections, DCE adjustments, and more. We kindly ask for your support to help us spot any more issues with the IR compiler backend – so go and try it out 👌
    👏 12
    :kotlin: 4
    :kotlin-flag: 8
    e
    i
    • 3
    • 2
  • m

    Milan Hruban

    03/28/2020, 9:34 AM
    Hi, I am trying to create a chrome browser extension in Kotlin. I didn't find many projects using this approach. It seems to me that only thing we are missing is to generate the browser api declarations, and it's perfectly usable (someone already did that, but only for firefox and it seems that that project is no longer updated https://kotlinconf.com/2019/talks/video/2018/21914/). Is there some reason I am missing why are people not using kotlin for browser extensions?
    i
    p
    • 3
    • 2
  • s

    spierce7

    03/28/2020, 7:50 PM
    How stable is the 1.4 M1 for js? Anyone try it yet?
    t
    s
    • 3
    • 3
  • u

    uli

    03/28/2020, 9:10 PM
    Hi, i am trying to use
    <https://www.npmjs.com/package/@abandonware/noble>
    with dukat:
    implementation(npm("@abandonware/noble", "1.9.2-7"))
    The problem is, that dukat only generates top level functions which can not be resolved at runtime:
    @file:Suppress("INTERFACE_WITH_SUPERCLASS", "OVERRIDING_FINAL_MEMBER", "RETURN_TYPE_MISMATCH_ON_OVERRIDE", "CONFLICTING_OVERLOADS", "EXTERNAL_DELEGATION")
    
    import ...
    
    external fun startScanning(callback: (error: Error) -> Unit = definedExternally)
    If a add my own type definitions like that things work:
    @file:Suppress("INTERFACE_WITH_SUPERCLASS", "OVERRIDING_FINAL_MEMBER", "RETURN_TYPE_MISMATCH_ON_OVERRIDE", "CONFLICTING_OVERLOADS", "EXTERNAL_DELEGATION")
    
    val noble: Noble = js("require('@abandonware/noble')")
    
    external class Noble : events.EventEmitter {
        fun startScanning(callback: (error: Error) -> Unit = definedExternally)
    Am I donig something wrong? Are the type script definitons of the package broken? Or is it just dukat? Btw. the project is compiled with
    kotlin {
        target {
            useCommonJs()
            nodejs()
    t
    • 2
    • 26
  • r

    Robert Jaros

    03/30/2020, 11:35 AM
    What could be the reason of such error? It's bound to the specific user environment, but I can't find a clue what exactly is wrong. Any ideas? Any additional logs we can check?
    C:\data\master\experimenting-with-kotlin-js>gradlew.bat run -t
    
    > Task :kotlinNpmInstall FAILED
    error Couldn't find package "is-sorted@*" required by "experimenting-with-kotlin-js@1.0.0-SNAPSHOT" on the "npm" registry.
    Error: Couldn't find package "webpack@4.41.2" required by "experimenting-with-kotlin-js@1.0.0-SNAPSHOT" on the "npm" registry.
        at MessageError.ExtendableBuiltin (C:\Users\joerg.rade\.gradle\yarn\yarn-v1.21.1\lib\cli.js:721:66)
        at new MessageError (C:\Users\joerg.rade\.gradle\yarn\yarn-v1.21.1\lib\cli.js:750:123)
        at PackageRequest.<anonymous> (C:\Users\joerg.rade\.gradle\yarn\yarn-v1.21.1\lib\cli.js:36539:17)
        at Generator.throw (<anonymous>)
        at step (C:\Users\joerg.rade\.gradle\yarn\yarn-v1.21.1\lib\cli.js:310:30)
        at C:\Users\joerg.rade\.gradle\yarn\yarn-v1.21.1\lib\cli.js:323:13
        at processTicksAndRejections (internal/process/task_queues.js:93:5)
    Error: Couldn't find package "webpack-dev-server@3.9.0" required by "experimenting-with-kotlin-js@1.0.0-SNAPSHOT" on the "npm" registry.
        at MessageError.ExtendableBuiltin (C:\Users\joerg.rade\.gradle\yarn\yarn-v1.21.1\lib\cli.js:721:66)
        at new MessageError (C:\Users\joerg.rade\.gradle\yarn\yarn-v1.21.1\lib\cli.js:750:123)
        at PackageRequest.<anonymous> (C:\Users\joerg.rade\.gradle\yarn\yarn-v1.21.1\lib\cli.js:36539:17)
        at Generator.throw (<anonymous>)
        at step (C:\Users\joerg.rade\.gradle\yarn\yarn-v1.21.1\lib\cli.js:310:30)
        at C:\Users\joerg.rade\.gradle\yarn\yarn-v1.21.1\lib\cli.js:323:13
        at processTicksAndRejections (internal/process/task_queues.js:93:5)
    Error: Couldn't find package "webpack-cli@3.3.10" required by "experimenting-with-kotlin-js@1.0.0-SNAPSHOT" on the "npm" registry.
        at MessageError.ExtendableBuiltin (C:\Users\joerg.rade\.gradle\yarn\yarn-v1.21.1\lib\cli.js:721:66)
        at new MessageError (C:\Users\joerg.rade\.gradle\yarn\yarn-v1.21.1\lib\cli.js:750:123)
        at PackageRequest.<anonymous> (C:\Users\joerg.rade\.gradle\yarn\yarn-v1.21.1\lib\cli.js:36539:17)
        at Generator.throw (<anonymous>)
        at step (C:\Users\joerg.rade\.gradle\yarn\yarn-v1.21.1\lib\cli.js:310:30)
        at C:\Users\joerg.rade\.gradle\yarn\yarn-v1.21.1\lib\cli.js:323:13
        at processTicksAndRejections (internal/process/task_queues.js:93:5)
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':kotlinNpmInstall'.
    >                 Process 'Resolving NPM dependencies using yarn' returns 1
    
                      yarn install v1.21.1
      info No lockfile found.
      [1/4] Resolving packages...
      info Visit <https://yarnpkg.com/en/docs/cli/install> for documentation about this command.
    
    
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    
    * Get more help at <https://help.gradle.org>
    
    BUILD FAILED in 11s
    2 actionable tasks: 2 executed
    i
    t
    • 3
    • 8
  • i

    Ian Stewart

    03/30/2020, 3:07 PM
    Hello all; an open question to know what direction I should investigate in. I’m using 1.4-M1, and aiming to build a multiplatform library to be used in a variety of products, including desktop and JS. Specifically for the JS library, what is generated under build/js seems to be a yarn-workspace, with kotlin, kotlin-source-map-loader, and my library, and links between all of them. I’m now trying to npm link from a sample js app that would use my library. I cannot use the library by itself, because it refers to kotlin 1.4M1 and kotlin-source-map-loader 1.4M1, but only Kotlin seems to be available on npm (why is kotlin-source-map-loader not on npm?) What is the suggested direction to go? Shoud I be webpacking my library? Am I missing something in terms of setup for npm or yarn? Does anyone have a relatively simple sample setup?
    i
    • 2
    • 3
  • k

    kartoffelsup

    03/30/2020, 7:58 PM
    Hi, are there any samples of how to setup gradle to use my modified dukat typings? What dukat generates unfortunately doesn't compile so I'd like to use the ones I adjusted to compile. But I can't get it to work. It compiles but the imports/requires aren't added to the outputted js file. Any hints?
    l
    b
    u
    • 4
    • 15
  • n

    Nicholas Bilyk

    03/30/2020, 8:30 PM
    I just upgraded to Kotlin 1.3.70 and now when I do a production JS build I get an 'undefined' error from Terser.
    Version: webpack 4.41.2
    Time: 9419ms
    Built at: 03/30/2020 3:24:01 PM
     2 assets
    Entrypoint main = app-production.js app-production.js.map
     [0] ./kotlin-dce/kotlin.js 424 KiB {0} [built]
     [1] ./kotlin-dce/acornui-acornui-utils.js 695 KiB {0} [built]
     [2] ./kotlin-dce/acornui-acornui-core.js 2.35 MiB {0} [built]
     [3] ./kotlin-dce/kotlinx-coroutines-core.js 297 KiB {0} [built]
     [4] ./kotlin-dce/asdf-app-common.js 352 KiB {0} [built]
     [5] ./kotlin-dce/kotlinx-serialization-kotlinx-serialization-runtime.js 342 KiB {0} [built]
     [7] (webpack)/buildin/global.js 472 bytes {0} [built]
     [9] multi ./kotlin-dce/asdf-app.js 28 bytes {0} [built]
    [10] ./kotlin-dce/asdf-app.js 136 KiB {0} [built]
    [18] ./kotlin-dce/asdf-ddc.js 115 KiB {0} [built]
    [19] ./kotlin-dce/asdf-demo-module.js 75.9 KiB {0} [built]
    [20] ./kotlin-dce/asdf-theme-builder.js 131 KiB {0} [built]
    [21] ./kotlin-dce/asdf-rich-text-editor.js 6.4 KiB {0} [built]
    [22] ./kotlin-dce/asdf-timesheet.js 118 KiB {0} [built]
    [23] ./kotlin-dce/acornui-acornui-webgl-backend.js 174 KiB {0} [built]
        + 9 hidden modules
    
    ERROR in app-production.js from Terser
    undefined
    Any idea how I can troubleshoot this? It was working in the 1.3.70 EAP
    b
    i
    • 3
    • 8
  • r

    Rob Murdock

    03/30/2020, 8:31 PM
    Is there anyway to lock the package.json? Apparently Terser put out an update a few hours ago that well… does that ^ (see above post) https://github.com/terser/terser/issues/624
    n
    l
    +2
    • 5
    • 50
  • n

    nwillc

    03/31/2020, 2:39 AM
    Total newbie (to JS ecosystem) question here. I've made a standard KotlinJS project in Intellij and chose nodejs as the target. Just a hello-world. The
    gradle run
    works as expected. Is there a way to run it with npm from the command line?
    b
    • 2
    • 3
  • r

    Robert Jaros

    03/31/2020, 8:43 AM
    Is there any way to configure karma daemon "interactive" tests in the browser with the new Kotlin/JS plugin (like it was with the old
    kotlin-frontend-plugin
    )?
    t
    u
    i
    • 4
    • 9
  • p

    pabl0rg

    03/31/2020, 3:29 PM
    Folks, please vote for this issue: https://youtrack.jetbrains.com/issue/KT-16604 Kotlin would never have gotten anywhere on the JVM if compiled jars were not usable from Java source.
    d
    c
    +3
    • 6
    • 27
  • a

    aerb

    03/31/2020, 5:56 PM
    Sorry for the newb question, but trying to start my first js project and getting this error. Any ideas?
    b
    u
    • 3
    • 7
  • f

    fkrauthan

    04/01/2020, 12:39 AM
    So I have a small problem with the old
    kotlin2js
    plugin I was able to set the output Javascript filename with the following snippet in my
    build.gradle.kts
    :
    setProperty("archivesBaseName", "main")
    but in the new js plugin this just renames the single file in
    distributions
    but not the output in the DCE output directory. There the main source code file is still called
    ${rootProject.name}-${project.name}.js
    is there any way to have the file that is placed in the DCE output folder to be called
    main.js
    instead?
    t
    • 2
    • 5
  • d

    diesieben07

    04/01/2020, 8:53 AM
    Trying out the preview version of
    .d.ts
    generation, ran into issues / unsupported things very fast (can't even export enums 😕). Off to youtrack I go...
    👍 2
    t
    • 2
    • 17
  • s

    spand

    04/01/2020, 1:10 PM
    After bumping to 1.3.71 I am getting OOM while compiling with
    kotlin2js
    in gradle. I tried setting
    kotlin.daemon.jvm.options=-Xmx8g
    in gradle.properties but even then I still get it (its a bit non deterministic). Am I setting the option correctly ?
    u
    • 2
    • 4
  • g

    Gunslingor

    04/01/2020, 5:55 PM
    I'm confused by node.js with KotlinJS or Kotlin multiplatform. I don't know tons about node but it seems like a simulator for a browser (maybe server too) and a generic package manager? I don't understand when to use it, I thought I had read that node modules (like metro 4, bootstrap, three.js, fs, etc) shouldn't be served up to the client/frontend, is that true? I'm confused by what implementation(npm()) is really doing. I sort of imagined that node npm would manage all my packages and other node packages like webpack would export/minify/obfuscate everything for me in a configurable way. I'm not sure.
    j
    i
    • 3
    • 8
  • g

    galex

    04/03/2020, 8:56 AM
    Hello, big congratz to the Kotlin JS Team for 1.4-M1 👏👏👏👏 I’ve tried it right now and
    @JsExport
    has an issue with a data class that is
    @Serializable
    :
    @CommonJsExport
    @Serializable
    data class EventDetails(var answer_id: Int? = null)
    At compilation, I get the following error:
    e: java.lang.AssertionError: Properties without fields are not supported my.package.EventDetails.Companion_instance
    So the generated
    serializer()
    of
    kotlinx-serialization
    blocks
    @JsExport
    i
    d
    • 3
    • 5
  • g

    galex

    04/03/2020, 9:00 AM
    Another issue I see with the generated
    d.ts
    file is that it contains definitions for classes only annotated with
    @JsExport
    and not all the classes that are referenced inside that class.
    t
    i
    • 3
    • 4
  • a

    Andrew

    04/03/2020, 8:16 PM
    I'm just getting started on learning this. Based on the first tutorial I found it looks like the entire dev environement is based on an IntelliJ Project which makes sense. Is there any concept of using Kotlin JS to compliment a pure npm/node dev environement? Or at minimum maybe just generating shared code that a non-kotlin project can just import. Basically looking for some way to benefit from Kotlin JS without getting locked into the ecosystem if that makes sense.
    p
    g
    • 3
    • 3
Powered by Linen
Title
a

Andrew

04/03/2020, 8:16 PM
I'm just getting started on learning this. Based on the first tutorial I found it looks like the entire dev environement is based on an IntelliJ Project which makes sense. Is there any concept of using Kotlin JS to compliment a pure npm/node dev environement? Or at minimum maybe just generating shared code that a non-kotlin project can just import. Basically looking for some way to benefit from Kotlin JS without getting locked into the ecosystem if that makes sense.
p

patrickdelconte

04/03/2020, 8:20 PM
you can use gradle on the command line for building and your editor of choice for writing code
g

galex

04/04/2020, 9:34 AM
Makes total sense. I used Kotlin Multiplatform for a Kotlin/JS and didn’t like being forced out of the web world to write web code. Feels unnatural to me, so I am in the process of building my multiplatform lib as a simple autonomous file (using ./gradlew jsBrowserWebpack and I’ll be using it in a clean pure react app.
a

Andrew

04/04/2020, 11:31 PM
That is kind of what I was getting at, seems like a library is the middle ground here if I wanted the final solution to ultimately be built in a 100% web world to standardize it a bit more.
View count: 6