Kotlin/JS project templates To improve the user ex...
# javascript
d
Kotlin/JS project templates To improve the user experience, we plan to add more Kotlin/JS project templates to the new Kotlin Project Wizard (KT-41774): Browser application – a blank application targeting the browser with: • Kotlinx.html – type-safe Kotlin DSL for creating HTML elements and building DOM trees. • CSS support (enabled by default) – enables support for webpack’s CSS and style loaders. Disable only if you provide your own webpack configuration. Node.js application – a blank application targeting Node.js with experimental Node.js API (kotlinx-nodejs). React application – a blank application with*:* • Kotlin-wrapped styled-components – adds a type-safe way to author and inject CSS stylesheets. • Kotlin-wrapped react-router – adds navigational components to keep your URLs and UIs synchronized. • Kotlin-wrapped react-redux – adds state containers powered by Redux. • CSS support (enabled by default) – enables support for webpack’s CSS and style loaders. Disable only if you plan to include your own webpack configuration.
🎉 3
🔥 7
❤️ 11
r
Type-safe wrappers are awesome for new projects and people who are used to Kotlin already, but one thing that felt missing last time I was exploring Kotlin/JS (a few months ago) was guidance around how to interop with existing projects that aren't making use of such things.
👍 4
b
@russhwolf could you please provide more info about what kind of existing project would you like interop with?
r
I don't do enough JS to have something super concrete. Broadly I'd love a template that includes calling Kotlin from JS or Typescript and vice versa, since the interop wasn't very clear to me when I tried it out. Like how the mobile templates include calling into Kotlin from Swift.
👍 1
b
Got it, thanks
@russhwolf JFYI: there are docs how to do it — https://kotlinlang.org/docs/reference/js-to-kotlin-interop.html
r
Yeah I've seen that but I had trouble understanding project config. eg how to embed a kotlin library into a JS/TS project. All I could figure out was copying outputs from the kotlin build folder into the JS project source, but it feels like there should be a more automatic way to do it that I couldn't find
b
Please take a look at a simple project how to do with the new compiler which able to produce d.ts files that makes using from JS/TS more enjoyable.
r
Yes that looks very helpful. Thank you!
👍 1