-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kotlin Coroutines support? #2
Comments
Editing the generated index.js file to change this line
to pass false instead of !0 lets the worker run successfully, so that does seem to be the issue. That being said, what is your use case for kotlin coroutines on Workers? It looks like a 5x size penalty in the generated javascript. |
@koeninger it works now. you did help me :) You know lots of Kotlin frameworks use Kotlinx.coroutines, such as Ktor etc, and suspend method is more friendly than JS Promise. It's true that the final bundle size is some big with Kotlin & coroutines runtime, but still be acceptable. I adjust compiler to use js(IR) and final bundle size just half now.
|
Does it mean one would need to edit the generated code manually after each compilation to have it run on cloudflare worker? |
@LouisCAD you can add some code in build.gradle.kts for replacement. My code:
|
@linux-china Shouldn't you just use |
you should do the replacement too with following configuration.
|
The replacement is still needed when building for the |
Upgrade worker to Kotlin 1.4.0 and all is good. But failed to run worker with kotlinx:kotlinx-coroutines-core-js. Cloudflare runtime compatible problem or my code problem?
build.gradle.kts:
Example code:
The text was updated successfully, but these errors were encountered: