Skip to content

Commit e2ec496

Browse files
feat: support wrangler.json and wrangler.jsonc (#53)
1 parent cc93683 commit e2ec496

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/index.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,15 @@ async function nitroModule(nitro: Nitro) {
2525
return; // Production doesn't need this
2626
}
2727

28-
// Find wrangler.toml
28+
// Find wrangler.json > wrangler.jsonc > wrangler.toml
2929
let configPath = nitro.options.cloudflareDev?.configPath;
3030
if (!configPath) {
31-
configPath = await findFile("wrangler.toml", {
32-
startingFrom: nitro.options.srcDir,
33-
}).catch(() => undefined);
31+
configPath = await findFile(
32+
["wrangler.json", "wrangler.jsonc", "wrangler.toml"],
33+
{
34+
startingFrom: nitro.options.srcDir,
35+
},
36+
).catch(() => undefined);
3437
}
3538

3639
// Resolve the persist dir
@@ -60,7 +63,7 @@ async function nitroModule(nitro: Nitro) {
6063
[
6164
"🔥 Cloudflare context bindings enabled for dev server",
6265
"",
63-
`Config path: \`${configPath ? relative(".", configPath) : colorize("yellow", "cannot find `wrangler.toml`")}\``,
66+
`Config path: \`${configPath ? relative(".", configPath) : colorize("yellow", "cannot find `wrangler.json`, `wrangler.jsonc`, or `wrangler.toml`")}\``,
6467
`Persist dir: \`${relative(".", persistDir)}\` ${addedToGitIgnore ? colorize("green", "(added to `.gitignore`)") : ""}`,
6568
].join("\n"),
6669
);

0 commit comments

Comments
 (0)