I'm getting an error when running suspending funct...
# javascript
r
I'm getting an error when running suspending function (even simple
delay()
) after webpack hot reload. It seems to be new issue with Kotlin JS/IR 1.5.2x or coroutines 1.5.1.
Don't know how to debug this - I only have this stack trace:
Copy code
"ClassCastException
    at THROW_CCE (webpack-internal:///./kotlin/showcase.js:19003:11)
    at _get_DefaultDelay_ (webpack-internal:///./kotlin/showcase.js:79393:44)
    at _get_delay__0 (webpack-internal:///./kotlin/showcase.js:75356:37)
    at delay (webpack-internal:///./kotlin/showcase.js:75329:7)
    at _no_name_provided__896.doResume_0_k$ (webpack-internal:///./kotlin/showcase.js:117391:29)
    at _no_name_provided__896.invoke_2i3g7c_k$ (webpack-internal:///./kotlin/showcase.js:117371:16)
    at _no_name_provided__1_3.l [as _$this_createCoroutineUnintercepted] (webpack-internal:///./kotlin/showcase.js:117939:16)
    at _no_name_provided__1_3.doResume_2_0_k$ (webpack-internal:///./kotlin/showcase.js:20517:17)
    at _no_name_provided__1_3.doResume_0_k$ (webpack-internal:///./kotlin/showcase.js:20520:17)
    at _no_name_provided__1_3.CoroutineImpl_0.resumeWith_jccoe6_k$ (webpack-internal:///./kotlin/showcase.js:20419:37)"
The problem is with IR only (works fine with legacy backend)
I'm using full HMR with
config.devServer.hot = true;
No error with standard hot reload.
b
Have you tried 1.5.30-M1? If it won't fix the issue, at least it'll give you a propper stack trace for ir
r
Haven't tried 1.5.30 yet
Creating a sample project with full HMR without KVision is so hard ... ;]
I've manged to reproduce the issue on Kotlin 1.4.30 as well.
And on 1.5.30-M1 as well (stacktrace doesn't seem to be any better 😞)
b
It was supposed to generate source maps. Guess that's not quite there still
r
in fact it does generate source maps
but the main stack trace with kotlin sources is not useful because it seems to be different coroutine (?)
only the stacktrace inside the exception itself (javascript stacktrace) seems to give some info about the problem
you can play with my sample if you want 🙂 https://github.com/rjaros/kt47832