Migrate to cf CLI + cloudflare.config.ts once RWSDK supports it #5

Open arsdehnel.com
Open opened by arsdehnel.com

Cloudflare is actively developing a new TypeScript-based config format (cloudflare.config.ts) to replace wrangler.jsonc, along with a new cf CLI to replace wrangler. As of November 2026, cf is at 1.0.0-beta.27 and @cloudflare/config is at 0.30.1 (explicitly marked "not yet stable for external use").

Why this is worth doing eventually

The new format directly solves the most painful part of our current wrangler setup: vars (and all bindings) are non-inheritable, so every environment block must repeat the full set. The TypeScript config replaces this with a plain function:

export default defineConfig((ctx) => ({ worker: { env: { // shared bindings defined once ATPROTO_OAUTH_SCOPE: bindings.text("atproto repo:xyz.statusphere.status"), KV_OAUTH_STATE: bindings.kv({ id: KV_IDS[ctx.mode] }),

    // env-specific only where it differs
    ATPROTO_PDS_URL: ctx.mode === "docker"
      ? bindings.text("http://localhost:3000")
      : undefined,
  },
},

}));

You can also validate ctx.mode at config load time and get exhaustiveness checking on binding ID maps via Record<Mode, string>.

What's blocking it

RWSDK v1.7.5 is tightly coupled to wrangler in two ways:

  • redwoodPlugin.mjs calls unstable_readConfig from wrangler directly to determine the worker entry path — fails without wrangler.jsonc
  • buildApp.mjs explicitly looks for wrangler.json/jsonc/toml in the build output to patch assets.directory — has no concept of cloudflare.config.ts

The full chain needed: @cloudflare/vite-plugin v2 stabilizes → RWSDK updates against it → we can migrate.

When to revisit

Check back when:

  • @cloudflare/vite-plugin v2 hits a stable 2.0.0 release
  • RWSDK publishes a release that drops the direct wrangler import in its vite plugin
  • @cloudflare/config removes its "not stable for external use" warning

The cf migrate command exists and can auto-convert wrangler.jsonc → cloudflare.config.ts when the time comes.

Sign up or Sign in to add to the discussion.