Kotlin/JS dead code elimination
Unused declarations can appear in cases like:
A function is inlined and never gets called directly (which happens always except for a few situations).
The Kotlin/JS Gradle plugin handles DCE automatically when you build a production bundle, for example by using the
browserProductionWebpack task. Development bundling tasks (like
browserDevelopmentWebpack) don't include DCE.
Exclude declarations from DCE
To keep certain declarations from elimination, add the
dceTask block to your Gradle build script and list the declarations as arguments of the
keep function. An argument must be the declaration's fully qualified name with the module name as a prefix:
To turn off DCE completely, use the
devMode option in the