lukeed / cfw

(WIP) A build and deploy utility for Cloudflare Workers.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

wrangler.toml with module workers

dhrubabasu opened this issue · comments

Currently, my wrangler.toml needs to include all of these for it to work in wrangler dev:

[build]
command = "yarn run build"

[build.upload]
format = "modules"
dir = "./build"
main = "./index.js"

[[build.upload.rules]]
type = "ESModule"
globs = ["**/*.js"]

It could be good to include some documentation regarding this, took me a while to figure out the build.upload.rules part. https://developers.cloudflare.com/workers/cli-wrangler/configuration#buildupload-1

cfw has nothing to do with a wrangler.toml file

You can upload a module with cfw with this config file:

// package.json
{
  "scripts": {
    "build": "cfw build",
    "deploy": "cfw deploy"
  }
}

// cfw.js
/**
 * @type {import('cfw').Config}
 */
const config = {
  name: '...',
  module: true,
};

module.exports = config;

This was doable as of the 0.2.0 release.