deviant
03/04/2018, 11:57 AMkotlinx-coroutines-core-js
on npm?elizarov
03/04/2018, 3:14 PMdeviant
03/04/2018, 3:24 PMcommon
module which i don't know how to import into npm
project. is it possible?spierce7
03/04/2018, 7:36 PMincludeBuild('../kotlinx.coroutines') {
//noinspection GroovyAssignabilityCheck
dependencySubstitution {
//noinspection GroovyAssignabilityCheck
substitute module('org.jetbrains.kotlinx:kotlinx-coroutines-core-js') with project(':kotlinx-coroutines-core-js')
//noinspection GroovyAssignabilityCheck
substitute module('org.jetbrains.kotlinx:kotlinx-coroutines-core-common') with project(':kotlinx-coroutines-core-common')
}
}
You should now be able to include the js coroutines in your project via the normal compile 'org.jetbrains.kotlinx:kotlinx-coroutines-core-js:<version here>'
means.
Now you need to add the kotlin dce plugin to your project:
apply plugin: 'kotlin-dce-js'
Also include the following option to turn off dead code elimination while developing for faster compiles:
runDceKotlinJs.dceOptions.devMode = true
And then all your js libraries will be output to a single location: ./build/kotlin-js-min/main/
Then all you need to do is to add those files to npm. Next to your node_modules
directory, I created a node_modules_local/kotlinx-coroutines-core-js
directory, with the following `package.json`:
{
"main": "<path to your project dir>/build/kotlin-js-min/main/kotlinx-coroutines-core-js.js",
"name": "kotlinx-coroutines-core-js",
"version": "1.0.0"
}
And then finally in your main project package.json
, you can include it to be packaged like this:
"dependencies": {
...
"kotlinx-coroutines-core-js": "file:node_modules_local/kotlinx-coroutines-core-js",
...
},
runDceKotlinJs.dceOptions.devMode
to false, and then you have the unused code stripped out. This is practically essential with the kotlin std-lib imo.deviant
03/04/2018, 7:43 PMcreate-react-kotlin-app
which is npm project. i've tried gradle frontend plugin, but experienced various issues with it, so i gave up and switched back to pure npmspierce7
03/04/2018, 8:48 PMdeviant
03/04/2018, 9:30 PMspierce7
03/05/2018, 3:31 AMdeviant
03/05/2018, 8:08 AM-t
param. basically that was the main reason why i'm back to npm+webpack