Someone mentioned Kotlin JS and ES6 in another channel, and I found the ticket for it - https://youtrack.jetbrains.com/issue/KT-8373
What are the benefits that will come from supporting ES6 directly?
a
andylamax
01/02/2023, 2:04 AM
At the moment, the javascript generated by the kotlin.js compiler results in a huge bundle which is not tree shakeable.
ES6 allows tools like webpack to do their job well and shake all unused code.
Although its an output, ES6 is slightly more readable than its ES5 variant
s
spierce7
01/02/2023, 2:14 AM
I thought the IR library did a pretty good job of removing code that wasn't used. Do you mean this from the perspective of shipping a Kotlin library, or will this benefit a Kotlin js Only application as well?
t
turansky
01/02/2023, 2:45 AM
It works like Lego blocks (1 block = 1 js file)
Small blocks (js files) = more optimal bundles, that is why file to file compilation is required
With ES6 modules it will be possible to remove unused logic from block (file) - “treeshake”
👍 2
a
andylamax
01/03/2023, 1:10 AM
@turansky are there really plans for file to file compilation??? even in the far future??