Skip to content
Cloudflare Docs

WranglerConfig

The WranglerConfig component is used 458 times on 248 pages.

See all examples of pages that use WranglerConfig

Used 458 times.

Pages

Partials

This component can be used to automatically generate a jsonc version of the toml file (or vice versa) of the Cloudflare Wrangler configuration file.

Import

import { WranglerConfig } from "~/components";

Usage

{
"$schema": "./node_modules/wrangler/config-schema.json",
"d1_databases": [
{
"binding": "DB",
"database_name": "prod-d1-tutorial",
"database_id": "<unique-ID-for-your-database>"
}
]
}
import { WranglerConfig } from "~/components";
<WranglerConfig>
```toml
[[d1_databases]]
binding = "DB" # available in your Worker on env.DB
database_name = "prod-d1-tutorial"
database_id = "<unique-ID-for-your-database>"
```
</WranglerConfig>

Compatibility date

You should generally use $today for the compatibility_date value for new projects. This magic string is automatically replaced with the current date at build time, ensuring documentation always suggests the latest date. If you need to specify a fixed date, you can do so as well, but you may miss out on the latest features and performance improvements. You can disable specific features by using compatibility flags.

{
"name": "my-worker",
"compatibility_date": "2026-02-03"
}
import { WranglerConfig } from "~/components";
<WranglerConfig>
```jsonc
{
"name": "my-worker",
"compatibility_date": "$today"
}
```
</WranglerConfig>

Minimum compatibility dates

Some features require a minimum compatibility date. When documenting these features, use a :::note component to communicate the requirement clearly on the docs page:

:::note
This feature requires a `compatibility_date` of `2024-09-23` or later.
:::

The removeSchema prop can be used to remove the $schema reference from the generated JSON file. This can be useful if you want to add snippets of configuration files that are easier to copy paste, and are providing toml as the source config format.

If you provide jsonc as the source config format, the removeSchema prop will be ignored.

{
"d1_databases": [
{
"binding": "DB",
"database_name": "prod-d1-tutorial",
"database_id": "<unique-ID-for-your-database>"
}
]
}
import { WranglerConfig } from "~/components";
<WranglerConfig removeSchema>
```toml
[[d1_databases]]
binding = "DB" # available in your Worker on env.DB
database_name = "prod-d1-tutorial"
database_id = "<unique-ID-for-your-database>"
```
</WranglerConfig>