Workers and Kotlin (import types + webpack config)

Hi everyone,

I’ve been messing around with Kotlin for Workers and I have a couple of questions that I’m stuck on.

  1. Where can I import the type for KVNamespace? Do I need to add a dependency to gradle?
  2. How can I specify a webpack config to disable minifying js?

Thanks

  1. I’m not aware of any complete Kotlin type definitions for Cloudflare specific features. Easiest approach is writing definitions for only the features you’re using, see Use JavaScript code from Kotlin | Kotlin
  2. In build.gradle.kts replace dependsOn(“browserProductionWebpack”) with dependsOn(“browserDevelopmentWebpack”). This will make the js file too big to actually upload to a worker, but may be useful for seeing what the generated code looks like.