cashapp / zipline

Run Kotlin/JS libraries in Kotlin/JVM and Kotlin/Native programs
Apache License 2.0
2.07k stars 159 forks source link

ES2015 crashes compiler #988

Open JakeWharton opened 1 year ago

JakeWharton commented 1 year ago

Adding

js {
  browser {
    compilerOptions {
      target = 'es2015'
    }
  }
}

to a module with the Zipline plugin causes

Caused by: java.util.NoSuchElementException: List is empty.
        at kotlin.collections.CollectionsKt___CollectionsKt.last(_Collections.kt:418)
        at app.cash.zipline.ZiplineManifest$Companion.create(ZiplineManifest.kt:254)
        at app.cash.zipline.ZiplineManifest$Companion.create$default(ZiplineManifest.kt:229)
        at app.cash.zipline.gradle.ZiplineCompiler.writeManifest(ZiplineCompiler.kt:149)
        at app.cash.zipline.gradle.ZiplineCompiler.compile(ZiplineCompiler.kt:57)
        at app.cash.zipline.gradle.ZiplineCompileTask.task(ZiplineCompileTask.kt:154)
JakeWharton commented 4 months ago

Somewhat related, but even if you try to only enable ES generators for coroutines that also doesn't work because we ban eval: https://youtrack.jetbrains.com/issue/KT-69642. However, ES 2015 modules can be used without ES generator-based coroutines, so we can still fix this first.