Skip to content

Commit be1c227

Browse files
authored
Wrap strings when using --define and --var in Wrangler (#21000)
1 parent 46b2713 commit be1c227

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,11 +464,11 @@ As of Wrangler v3.2.0, `wrangler dev` is supported by any Linux distributions pr
464464
- Protocol to forward requests to host on.
465465
- `--var` <Type text="key:value\[]" /> <MetaInfo text="optional" />
466466
- Array of `key:value` pairs to inject as variables into your code. The value will always be passed as a string to your Worker.
467-
- For example, `--var git_hash:$(git rev-parse HEAD) test:123` makes the `git_hash` and `test` variables available in your Worker's `env`.
467+
- For example, `--var "git_hash:'$(git rev-parse HEAD)'" "test:123"` makes the `git_hash` and `test` variables available in your Worker's `env`.
468468
- This flag is an alternative to defining [`vars`](/workers/wrangler/configuration/#non-inheritable-keys) in your [Wrangler configuration file](/workers/wrangler/configuration/). If defined in both places, this flag's values will be used.
469469
- `--define` <Type text="key:value\[]" /> <MetaInfo text="optional" />
470470
- Array of `key:value` pairs to replace global identifiers in your code.
471-
- For example, `--define GIT_HASH:$(git rev-parse HEAD)` will replace all uses of `GIT_HASH` with the actual value at build time.
471+
- For example, `--define "GIT_HASH:'$(git rev-parse HEAD)'"` will replace all uses of `GIT_HASH` with the actual value at build time.
472472
- This flag is an alternative to defining [`define`](/workers/wrangler/configuration/#non-inheritable-keys) in your [Wrangler configuration file](/workers/wrangler/configuration/). If defined in both places, this flag's values will be used.
473473
- `--tsconfig` <Type text="string" /> <MetaInfo text="optional" />
474474
- Path to a custom `tsconfig.json` file.

0 commit comments

Comments
 (0)