Using CloudFlare web dashboard it's possible to split your code into multiple files using ES module syntax. It works out of the box.
Is it possible to create such configuration using CF Terraform provider and cloudflare_worker_script
without JS bundles like webpack?
resource "cloudflare_worker_script" "spainter_script_file_utils" {
name = "spainter"
account_id = var.cloud_flare_account_id
content = file("./workers.js")
module = true
}
According to their documentation there's no such option
Unfortunately not - the API supports uploading other JavaScript files as additional modules but the Terraform provider hasn't implemented that so it expects you to bundle yourself using Webpack, esbuild, etc