I have not used kotlinjs yet and I tried looking f...
# javascript
s
I have not used kotlinjs yet and I tried looking for information about codesplitting support but I cant find anything about it at all. Has anyone seen anything about it ?
b
Automatic code splitting not supported. You should manually split your code to separate modules. Also, you can use js tools (like webpack) to achieve that.
s
I looked a bit more at the Kotlin Canvas demo on try.kotlinlang.org. It seems however that the imports are not preserved in the javascript code and that webpack requires some sort of imports depending on your module mechanism.
k
That's not true.
import
directive is, indeed, does not act as
require
in CommonJS. However, there's
external
modifier together with
@JsModule
annotation that's designed to interoperate with CommonJS. See http://kotlinlang.org/docs/reference/js-modules.html
s
Should
@JsModule
work on try.kotlinlang.org ?
But thanks. I missed that page. Will look into it.
k
No,
@JsModule
won't work in try.kotlinlang.org, since such a simple tool can't provide a full frontend stack there.