Anyone encountered issues where DCE seemingly remo...
# javascript
b
Anyone encountered issues where DCE seemingly removes something vital? I'm getting
Uncaught TypeError: g is not a function
after running dce on my page. Any suggestions how to investigate/resolve this?
i
Usually it is issues related with npm dependencies from
kotlin-wrappers
If you have these ones and you declare it via
npm
dependencies, I recommend to change on maven dependencies from bintray https://bintray.com/kotlin/kotlin-js-wrappers You always can set
development
mode to webpack (via
webpack.config.d/<some-file>.js
) and find what declaration was be removed and find, where it was removed from
b
Hmm it seems to be an issue with ktor-client-cio-js dependency. After DCE in bundle I can see
var encodeToByteArray = $module$ktor_ktor_<http://io.io.ktor.utils.io|io.io.ktor.utils.io>.charsets.encodeToByteArray_fj4osb$;
However this line bellow throws an error
CrLf = encodeToByteArray(charsets.Charsets.UTF_8.newEncoder(), '\r\n', 0, '\r\n'.length);
Copy code
Uncaught TypeError: encodeToByteArray is not a function
    at Object.<anonymous> (main.bundle.js:48602)
    at main.bundle.js:47583
    at Object.../../../../hazelcast-explorer/build/kotlin-js-min/frontend/main/ktor-ktor-http-cio.js (main.bundle.js:47586)
    at __webpack_require__ (main.bundle.js:20)
    at main.bundle.js:38338
    at Object.../../../../hazelcast-explorer/build/kotlin-js-min/frontend/main/ktor-ktor-client-core.js (main.bundle.js:38343)
    at __webpack_require__ (main.bundle.js:20)
    at Object.../../../../hazelcast-explorer/build/kotlin-js-min/frontend/main/hazelcast-explorer-root-hazelcast-explorer-frontend.js (main.bundle.js:6220)
    at __webpack_require__ (main.bundle.js:20)
    at Object.0 (main.bundle.js:163986)
i
Yes, it is known problem with DCE https://github.com/ktorio/ktor/issues/1339 There is WA inside
b
Thanks, that helped! Btw is kotlin 1.3.70 release? As WA there mentions it, however my gradle can't find it
i