Jue
01/23/2020, 8:33 PMWe have a JS library that needs to be loaded on the page to render some content. We are looking into moving some pieces of this library to KotlinJS. As such we have noticed that render performance on the page is very sensitive to our library's size, so we want to keep it as small as possible without any external dependencies. But so far it seems like JS generated by Kotlin has dependecy on `kotlin.js`, which needs to be loaded in browser before transpiled JS. We tried minifying+gziping kotlin.js, and it is still ~150kb in size, which is a deal breaker for us. So I wanted to confirm here if there is any possible way to not have to load `kotlin.js` and instead inline all the dependecies in the transpiled JS itself, or load only needed parts of it. Thanks.
glade
01/23/2020, 8:42 PMglade
01/23/2020, 8:42 PMIlya Goncharov [JB]
01/24/2020, 6:22 PMapp
module and files:
• https://github.com/ilgonmic/kotlinjs-multi-module/blob/master/app/build.gradle.kts - dceTask
option keep
is necessary to mark declarations, which you want to “save” in final bundle
• https://github.com/ilgonmic/kotlinjs-multi-module/blob/master/app/webpack.config.d/library.js - it is additional configuration for webpack to enable library mode with umd
target, so after you import you bundle on page, or require it in your script, you can get your functionsJue
02/09/2020, 6:02 AM