Jiri Bruchanov
11/25/2019, 4:14 PMhellman
11/26/2019, 7:09 AMthana
11/26/2019, 8:45 AMLong
value from the klock-library. Unfortunately klock-js brings its own kotlin.js library hence the Kotlin.Long
returned by klock is not the same Kotlin.Long
the rest of the application uses. Is there a way to exclude klock's dependency on kotlin?hellman
11/26/2019, 6:26 PMJoffrey
11/27/2019, 2:48 PMkotlinx.serialization
) in Kotlin/JS to parse JSON into Kotlin data classes?
@Test
fun jsonTest() {
data class Person(val name: String)
val expected = Person("Bob")
val parsedPerson = JSON.parse<Person>("""{"name":"Bob"}""")
assertEquals(expected, parsedPerson)
}
This test gives:
AssertionError: Expected <Person(name=Bob)>, actual <[object Object]>.
Filippo Orru
11/28/2019, 8:12 AMFilippo Orru
11/28/2019, 4:02 PMonClickFunction = {
println(it.target.value)
}
Doesn't workian.shaun.thomas
11/29/2019, 5:27 PMorg.jetbrains.kotlin.js
it's pretty trivial to get the browser dev setup working with the kotlin.target.browser {}
. What's not is where to go from here. How would I package the node outputs in /build/js
to be usable as static inputs in a ktor application in a multi module project? Given the js plugin seems to properly call node under the hood I'm imagining I can call some release task but reading the plugin source I'm not seeing anything obvious and the available tasks seem to be devoid of anything that would appear to create a consolidated output I can use statically.hellman
11/30/2019, 12:55 PMlit-element
, and the error I get when loading the JS file in the browser is
Uncaught ReferenceError: LitElement is not defined
Filippo Orru
12/02/2019, 8:16 AMuseState(0)
Hook doesn't work!
It throws the following Error:
Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons (...)
and then lists the reasons. Why is that? My Code is the following:Janelle Fullen
12/02/2019, 10:52 PMJanelle Fullen
12/03/2019, 8:03 PMGurupad Mamadapur [FH]
12/04/2019, 8:41 AMreact
imports (Unresolved reference for import react.dom.*
)
import react.dom.*
import kotlin.browser.document
fun main() {
render(document.getElementById("root")) {
h1 {
+"Hello, React+Kotlin/JS!"
}
}
}
build.gradle file -
plugins {
id 'org.jetbrains.kotlin.js' version '1.3.61'
}
group 'com.example'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
jcenter()
maven { url "<https://dl.bintray.com/kotlin/kotlin-js-wrappers>" }
maven { url "<https://dl.bintray.com/kotlin/kotlinx>" }
}
kotlin {
target {
browser()
}
sourceSets {
main {
dependencies {
implementation kotlin('stdlib-js')
implementation kotlin('test-js')
implementation kotlin('stdlib-js')
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime-js:0.10.0"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-js:1.2.0"
implementation(npm("core-js", "^2.0.0"))
implementation(npm("svg-inline-loader", "0.8.0"))
implementation(npm("kotlinx-html", "0.6.12"))
implementation(npm("@jetbrains/kotlin-react", "16.6.0-pre.67"))
implementation(npm("@jetbrains/kotlin-react-dom", "16.6.0-pre.67"))
implementation(npm("@jetbrains/kotlin-styled", "1.0.0-pre.67"))
implementation(npm("@jetbrains/kotlin-extensions", "1.0.1-pre.67"))
implementation(npm("@jetbrains/kotlin-css", "1.0.0-pre.67"))
implementation(npm("@jetbrains/kotlin-css-js", "1.0.0-pre.67"))
implementation(npm("react", "16.8.3"))
implementation(npm("react-dom", "16.8.3"))
implementation(npm("inline-style-prefixer", "5.0.4"))
implementation(npm("styled-components", "3.4.10"))
implementation(npm("@jetbrains/logos", "1.1.4"))
implementation(npm("@jetbrains/ring-ui", "2.0.0-beta.11"))
}
}
test {
dependencies {
implementation(npm("enzyme", "3.9.0"))
implementation(npm("enzyme-adapter-react-16", "1.12.1"))
}
}
}
}
bashor
12/05/2019, 12:00 PMRobert Jaros
12/05/2019, 12:00 PMRob Murdock
12/05/2019, 9:08 PMChristian Dräger
12/05/2019, 10:32 PMNikky
12/06/2019, 6:35 PMNikky
12/06/2019, 8:19 PMRob Murdock
12/09/2019, 4:16 PMkotlinNpmInstall FAILED
377
error Couldn't find package "myproject-package@1.4.5" required by "myproject-package-test@1.4.5" on the "npm" registry.
😅 Seems like once it has a version number, it tries to install the project I’m currently building from npm. Is this an issue other people have workarounds for? Should I open a ticket somewhere?spand
12/10/2019, 9:43 AMpackage-lock.json
. Is package-lock.json
supported in the new javascript plugin ?galex
12/10/2019, 11:22 AMBoris Dudelsack
12/10/2019, 11:39 AMNikky
12/10/2019, 4:19 PMkotlin("js")
how do i add dev dependencies for using webpack plugins and the like ?James Ward
12/10/2019, 8:05 PMNikky
12/10/2019, 9:08 PMgalex
12/11/2019, 9:43 AMumd
. I see that all classes and object (singletons) are generated as function() so I am not sure how I am supposed to use it in JavaScript, as when called I get undefined
as returned value. Any idea?ESchouten
12/11/2019, 10:14 AMmarstran
12/11/2019, 12:31 PMkotlinFrontend {
npm {
dependency "core-js"
}
}
Robert Jaros
12/12/2019, 10:42 AMkotlinFrontend {
define("PRODUCTION", true)
}
How to achieve the same in the new Kotlin/JS plugin?Robert Jaros
12/12/2019, 10:42 AMkotlinFrontend {
define("PRODUCTION", true)
}
How to achieve the same in the new Kotlin/JS plugin?Ilya Goncharov [JB]
12/12/2019, 11:25 AMwebpack.config.d
folder
config.mode = 'production' // set production mode to webpack
config.devtool = 'source-map' // or even false - it configure source map not to inline into bundle
Since 1.3.70 production and development build will be builtin
You can just run necessary task for development or for productionRobert Jaros
12/12/2019, 11:30 AMjs
file in webpack.config.d
?if (defined.PRODUCTION) {
// ...
}