Skip to content

Commit b5a3743

Browse files
authored
document multiple config flags in wrangler dev and types (#22290)
* document multiple config flags * fix type * also pages
1 parent 7c1c3b8 commit b5a3743

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/content/docs/workers/wrangler/commands.mdx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,9 @@ As of Wrangler v3.2.0, `wrangler dev` is supported by any Linux distributions pr
209209
- The path to an entry point for your Worker. Only required if your [Wrangler configuration file](/workers/wrangler/configuration/) does not include a `main` key (for example, `main = "index.js"`).
210210
- `--name` <Type text="string" /> <MetaInfo text="optional" />
211211
- Name of the Worker.
212+
- `--config`, `-c` <Type text="string[]" /> <MetaInfo text="optional" />
213+
- Path(s) to [Wrangler configuration file](/workers/wrangler/configuration/). If not provided, Wrangler will use the nearest config file based on your current working directory.
214+
- You can provide multiple configuration files to run multiple Workers in one dev session like this: `wrangler dev -c ./wrangler.toml -c ../other-worker/wrangler.toml`. The first config will be treated as the _primary_ Worker, which will be exposed over HTTP. The remaining config files will only be accessible via a service binding from the primary Worker.
212215
- `--no-bundle` <Type text="boolean" /> <MetaInfo text="(default: false) optional" />
213216
- Skip Wrangler's build steps. Particularly useful when using custom builds. Refer to [Bundling](https://developers.cloudflare.com/workers/wrangler/bundling/) for more information.
214217
- `--env` <Type text="string" /> <MetaInfo text="optional" />
@@ -965,6 +968,9 @@ wrangler pages dev [<DIRECTORY>] [OPTIONS]
965968
- IP address to listen on, defaults to `localhost`.
966969
- `--port` <Type text="number" /> <MetaInfo text="optional (default: 8788)" />
967970
- The port to listen on (serve from).
971+
- `--config`, `-c` <Type text="string[]" /> <MetaInfo text="optional" />
972+
- Path(s) to [Wrangler configuration file](/workers/wrangler/configuration/). If not provided, Wrangler will use the nearest config file based on your current working directory.
973+
- You can provide additional configuration files in order to run Workers alongside your Pages project, like this: `wrangler pages dev -c ./wrangler.toml -c ../other-worker/wrangler.toml`. The first argument must point to your Pages configuration file, and the subsequent configurations will be accessible via a Service binding from your Pages project.
968974
- `--binding` <Type text="string[]" /> <MetaInfo text="optional" />
969975
- Bind an environment variable or secret (for example, `--binding <VARIABLE_NAME>=<VALUE>`).
970976
- `--kv` <Type text="string[]" /> optional
@@ -1986,8 +1992,13 @@ wrangler types [<PATH>] [OPTIONS]
19861992
- Control the types that Wrangler generates for `vars` bindings.
19871993
- If `true`, (the default) Wrangler generates literal and union types for bindings (e.g. `myVar: 'my dev variable' | 'my prod variable'`).
19881994
- If `false`, Wrangler generates generic types (e.g. `myVar: string`). This is useful when variables change frequently, especially when working across multiple environments.
1989-
1990-
<Render file="wrangler-commands/global-flags" product="workers" />
1995+
- `--config`, `-c` <Type text="string[]" /> <MetaInfo text="optional" />
1996+
- Path(s) to [Wrangler configuration file](/workers/wrangler/configuration/). If the Worker you are generating types for has service bindings or bindings to Durable Objects, you can also provide the paths to those configuration files so that the generated `Env` type will include RPC types. For example, given a Worker with a service binding, `wrangler types -c wrangler.toml -c ../bound-worker/wrangler.toml` will generate an `Env` type like this:
1997+
```ts
1998+
interface Env {
1999+
SERVICE_BINDING: Service<import("../bound-worker/src/index").Entrypoint>;
2000+
}
2001+
```
19912002

19922003
---
19932004

0 commit comments

Comments
 (0)