kotlin-frontend-plugin | Gradle Kotlin plugin | Plugin library
kandi X-RAY | kotlin-frontend-plugin Summary
kandi X-RAY | kotlin-frontend-plugin Summary
Gradle Kotlin (plugin for frontend development
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of kotlin-frontend-plugin
kotlin-frontend-plugin Key Features
kotlin-frontend-plugin Examples and Code Snippets
Community Discussions
Trending Discussions on kotlin-frontend-plugin
QUESTION
I want to write a JavaScript library in Kotlin, using Gradle as the build tool with Kotlin as the config language for that, too. In the end I'd like to get a single JS file which can be used as a stand-alone library, i.e. with (all required parts of) the Kotlin library bundled into it.
What would a minimal setup to make this work look like? In particular, how do I get the Kotlin libraries bundled in?
Here is what I have so far.
https://kotlinlang.org/docs/tutorials/javascript/getting-started-gradle/getting-started-with-gradle.html
only uses Groovy to configure Gradle. It also uses the buildscript
in combination with the apply plugin
statement, where I was under the general impression that this is considered a legacy approach and the plugins
section would be the preferred way.
https://kotlinlang.org/docs/reference/using-gradle.html#targeting-javascript
has Kotlin scripts. The code snippet for settings.gradle
doesn't have a switch between Groovy and Kotlin, but it appears to work without modification in my settings.gradle.kts
. That will create a file js/build/classes/kotlin/main/${project.name}.js
which looks like this (with moduleKind = "commonjs"
):
ANSWER
Answered 2019-Mar-19 at 08:39Webpack can be used in order to create a single JS containing all dependencies.
https://github.com/eggeral/kotlin-single-js-file-lib shows a complete example
Make sure the KotlinJS compiler uses as module system which is understood by webpack.
QUESTION
As the title suggest, the coroutine builder runBlocking
is missing in the coroutine liblary I just added in my build.gradle. Funny thing is every other thing appears to be available, GlobalScope
, CoroutineScope.launch
CoroutineScope.async
all present. runBlocking
isn't. What am I doing wrong?
here is my build.gradle
ANSWER
Answered 2019-Mar-01 at 09:10After struggling here and there, I finally knew that runBlocking is only available in kotlin/jvm. So, it is not in kotlin/js or kotlin/common.
Just for future references, if you want to run multiplatform tests, then use this work around
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install kotlin-frontend-plugin
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page