Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support wrangler.json{,c} #53

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

franklin-tina
Copy link

@franklin-tina franklin-tina commented Jan 8, 2025

  • Add support for the new experimental wrangler.json and wrangler.jsonc formats
  • Update wrangler to version 3.100.0

I tested this locally by:

  1. deleting the original wrangler.toml file
  2. creating a wrangler.json or wrangler.jsonc file with the following content:
{
  "compatibility_date": "2022-07-12",
  "kv_namespaces": [
    {
      "binding": "KV",
      "id": "<KV_ID>"
    },
    {
      "binding": "KV2", // <--- I added this.
      "id": "<KV2_ID>"
    }
  ],
  "r2_buckets": [
    {
      "binding": "BLOB",
      "bucket_name": "default"
    }
  ]
}

after running the dev:nitro command, opening the local dev server, I was able to read the values from the new config:

Keys of cloudflare: request, env, context

Keys of cloudflare.env: KV, KV2, BLOB

Colo: YXE

typeof cloudflare.context.waitUntil: function

Before creating this PR, I confirmed the new wrangler config format works by manually setting the configPath value to wrangler.jsonc (or wrangler.json) in my nuxt.config.ts file:

export default defineNuxtConfig({
  // stuff...
  nitro: {
    preset: "cloudflare-module",
    cloudflareDev: {
      configPath: "wrangler.jsonc",
    }
  },
})
Operating System: Darwin
Node Version:     v22.9.0
Nuxt Version:     3.15.1
CLI Version:      3.18.2
Nitro Version:    2.10.4
Package Manager:  [email protected]
Builder:          -
User Config:      `compatibilityDate`, `devtools`, `future`, `modules`, `nitro`, vite`
Runtime Modules:  [email protected],
Build Modules:    -

fix: support multiple config file formats for Cloudflare
@franklin-tina franklin-tina changed the title feat: Add support for new the experimental wrangler config file formats feat: Add support for the new experimental wrangler config file formats Jan 8, 2025
@franklin-tina franklin-tina marked this pull request as ready for review January 8, 2025 07:45
@pi0 pi0 changed the title feat: Add support for the new experimental wrangler config file formats feat: support wrangler.json{,c} Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant