I've noticed that with IR there is no concept of "...
# javascript
r
I've noticed that with IR there is no concept of "unused Kotlin dependencies". With legacy backend I could add a Kotlin/JS dependency to a project, and if I didn't use it at all, it was fully removed from the final bundle (it was put into separate js module, which could be filtered by webpack tree-shaking). With IR just adding a dependency puts its code in the
projectName.js
file processed by webpack, which makes all
require()
directives resolved and added to the final bundle. It probably does not impact typical use cases, but for modular framework like KVision it makes a difference. I can't just work with an empty template project with all modules in
build.gradle.kts
, because the bundle is very large even though the application is just a "hello world". It's a bit surprising for me considering IR should make final bundles lighter šŸ˜‰
🧌 2
m
That’s why I’ve split up my project into multiple subprojects that dynamically depend on each other. So only ā€œminimalā€ JS loaded for the ā€œmain landing pageā€. But there are bugs. For example
jsjoda
is in that bundle and it doesn’t even use it. And it cannot optimize within a bundle. It either imports everything or nothing. Bot will likely be improved in the future.