Skip to content

Commit 669886f

Browse files
committed
update links and env notes
1 parent 22f1a2b commit 669886f

File tree

6 files changed

+60
-48
lines changed

6 files changed

+60
-48
lines changed

src/content/docs/workers/static-assets/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ The **assets directory** specified in your [Wrangler configuration file](/worker
6060
</WranglerConfig>
6161

6262
:::note
63-
With some build/development tools, including the Cloudflare Vite plugin, you don't need to specify `assets.directory`. This field is functionally equivalent to the build output folder.
63+
With some build/development tools, including the [Cloudflare Vite plugin](/workers/vite-plugin/), you do not need to specify `assets.directory`. This field is functionally equivalent to the build output folder.
6464
:::
6565

6666
By adding an [**assets binding**](/workers/static-assets/binding/#binding), you can directly fetch and serve assets within your Worker code.

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,7 @@ As of Wrangler v3.2.0, `wrangler dev` is supported by any Linux distributions pr
424424
- Skip Wrangler's build steps. Particularly useful when using custom builds. Refer to [Bundling](https://developers.cloudflare.com/workers/wrangler/bundling/) for more information.
425425
- `--env` <Type text="string" /> <MetaInfo text="optional" />
426426
- Perform on a specific environment.
427+
<Render file="vite-environments" />
427428
- `--compatibility-date` <Type text="string" /> <MetaInfo text="optional" />
428429
- A date in the form yyyy-mm-dd, which will be used to determine which version of the Workers runtime is used.
429430
- `--compatibility-flags`, `--compatibility-flag` <Type text="string[]" /> <MetaInfo text="optional" />
@@ -515,6 +516,7 @@ None of the options for this command are required. Also, many can be set in your
515516
- Skip Wrangler's build steps. Particularly useful when using custom builds. Refer to [Bundling](https://developers.cloudflare.com/workers/wrangler/bundling/) for more information.
516517
- `--env` <Type text="string" /> <MetaInfo text="optional" />
517518
- Perform on a specific environment.
519+
<Render file="vite-environments" />
518520
- `--outdir` <Type text="string" /> <MetaInfo text="optional" />
519521
- Path to directory where Wrangler will write the bundled Worker files.
520522
- `--compatibility-date` <Type text="string" /> <MetaInfo text="optional" />
@@ -1415,6 +1417,9 @@ wrangler versions upload [OPTIONS]
14151417
- Add a version message. Accepts empty string.
14161418
- `--name` <Type text="string" /> <MetaInfo text="optional" />
14171419
- Perform on a specific Worker rather than inheriting from the [Wrangler configuration file](/workers/wrangler/configuration/).
1420+
- `--env` <Type text="string" /> <MetaInfo text="optional" />
1421+
- Perform on a specific environment.
1422+
<Render file="vite-environments" />
14181423

14191424
<Render file="wrangler-commands/global-flags" product="workers" />
14201425

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

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ The majority of keys are inheritable, meaning that top-level configuration can b
6161

6262
Further, there are a few keys that can _only_ appear at the top-level.
6363

64-
With the [Cloudflare Vite plugin](/workers/local-development/vite/), you select a Wrangler environment at dev or build time via the `CLOUDFLARE_ENV` environment variable. Otherwise, environments are defined in your Wrangler config file as usual. For more detail on using Wrangler environments with the Cloudflare Vite plugin, refer to the [plugin documentation](/workers/local-development/vite#environments).
64+
<Render file="vite-environments" />
6565

6666
## Top-level only keys
6767

@@ -82,7 +82,7 @@ Top-level keys apply to the Worker as a whole (and therefore all environments).
8282
- `site` <Type text="object" /> <MetaInfo text="optional deprecated" />
8383

8484
- See the [Workers Sites](#workers-sites) section below for more information. Cloudflare Pages and Workers Assets is preferred over this approach.
85-
- This is not supported by the [Cloudflare Vite plugin](/workers/local-development/vite/).
85+
- This is not supported by the [Cloudflare Vite plugin](/workers/vite-plugin/).
8686

8787
## Inheritable keys
8888

@@ -132,7 +132,7 @@ At a minimum, the `name`, `main` and `compatibility_date` keys are required to d
132132
- `tsconfig` <Type text="string" /> <MetaInfo text="optional" />
133133

134134
- Path to a custom `tsconfig`.
135-
- Not applicable if you're using the [Cloudflare Vite plugin](/workers/local-development/vite/).
135+
- Not applicable if you're using the [Cloudflare Vite plugin](/workers/vite-plugin/).
136136

137137
- `triggers` <Type text="object" /> <MetaInfo text="optional" />
138138

@@ -141,42 +141,42 @@ At a minimum, the `name`, `main` and `compatibility_date` keys are required to d
141141
- `rules` <Type text="Rule" /> <MetaInfo text="optional" />
142142

143143
- An ordered list of rules that define which modules to import, and what type to import them as. You will need to specify rules to use `Text`, `Data` and `CompiledWasm` modules, or when you wish to have a `.js` file be treated as an `ESModule` instead of `CommonJS`.
144-
- Not applicable if you're using the [Cloudflare Vite plugin](/workers/local-development/vite/).
144+
- Not applicable if you're using the [Cloudflare Vite plugin](/workers/vite-plugin/).
145145

146146
- `build` <Type text="Build" /> <MetaInfo text="optional" />
147147

148148
- Configures a custom build step to be run by Wrangler when building your Worker. Refer to [Custom builds](#custom-builds).
149-
- Not applicable if you're using the [Cloudflare Vite plugin](/workers/local-development/vite/).
149+
- Not applicable if you're using the [Cloudflare Vite plugin](/workers/vite-plugin/).
150150

151151
- `no_bundle` <Type text="boolean" /> <MetaInfo text="optional" />
152152

153153
- Skip internal build steps and directly deploy your Worker script. You must have a plain JavaScript Worker with no dependencies.
154-
- Not applicable if you're using the [Cloudflare Vite plugin](/workers/local-development/vite/).
154+
- Not applicable if you're using the [Cloudflare Vite plugin](/workers/vite-plugin/).
155155

156156
- `find_additional_modules` <Type text="boolean" /> <MetaInfo text="optional" />
157157

158158
- If true then Wrangler will traverse the file tree below `base_dir`.
159159
Any files that match `rules` will be included in the deployed Worker.
160160
Defaults to true if `no_bundle` is true, otherwise false.
161161
Can only be used with Module format Workers (not Service Worker format).
162-
- Not applicable if you're using the [Cloudflare Vite plugin](/workers/local-development/vite/).
162+
- Not applicable if you're using the [Cloudflare Vite plugin](/workers/vite-plugin/).
163163

164164
- `base_dir` <Type text="string" /> <MetaInfo text="optional" />
165165

166166
- The directory in which module "rules" should be evaluated when including additional files (via `find_additional_modules`) into a Worker deployment. Defaults to the directory containing the `main` entry point of the Worker if not specified.
167-
- Not applicable if you're using the [Cloudflare Vite plugin](/workers/local-development/vite/).
167+
- Not applicable if you're using the [Cloudflare Vite plugin](/workers/vite-plugin/).
168168

169169
- `preserve_file_names` <Type text="boolean" /> <MetaInfo text="optional" />
170170

171171
- Determines whether Wrangler will preserve the file names of additional modules bundled with the Worker.
172172
The default is to prepend filenames with a content hash.
173173
For example, `34de60b44167af5c5a709e62a4e20c4f18c9e3b6-favicon.ico`.
174-
- Not applicable if you're using the [Cloudflare Vite plugin](/workers/local-development/vite/).
174+
- Not applicable if you're using the [Cloudflare Vite plugin](/workers/vite-plugin/).
175175

176176
- `minify` <Type text="boolean" /> <MetaInfo text="optional" />
177177

178178
- Minify the Worker script before uploading.
179-
- If you're using the [Cloudflare Vite plugin](/workers/local-development/vite/), `minify` is replaced by Vite's [`build.minify`](https://vite.dev/config/build-options.html#build-minify).
179+
- If you're using the [Cloudflare Vite plugin](/workers/vite-plugin/), `minify` is replaced by Vite's [`build.minify`](https://vite.dev/config/build-options.html#build-minify).
180180

181181
- `logpush` <Type text="boolean" /> <MetaInfo text="optional" />
182182

@@ -200,7 +200,7 @@ Non-inheritable keys are configurable at the top-level, but cannot be inherited
200200
- `define` <Type text="Record<string, string>" /> <MetaInfo text="optional" />
201201

202202
- A map of values to substitute when deploying your Worker.
203-
- If you're using the [Cloudflare Vite plugin](/workers/local-development/vite/), this is replaced by Vite's [`define`](https://vite.dev/config/shared-options.html#define).
203+
- If you're using the [Cloudflare Vite plugin](/workers/vite-plugin/), this is replaced by Vite's [`define`](https://vite.dev/config/shared-options.html#define).
204204

205205
- `vars` <Type text="object" /> <MetaInfo text="optional" />
206206

@@ -382,7 +382,7 @@ head_sampling_rate = 0.1 # 10% of requests are logged
382382
## Custom builds
383383

384384
:::note
385-
Not applicable if you're using the [Cloudflare Vite plugin](/workers/local-development/vite/).
385+
Not applicable if you're using the [Cloudflare Vite plugin](/workers/vite-plugin/).
386386
:::
387387

388388
You can configure a custom build step that will be run before your Worker is deployed. Refer to [Custom builds](/workers/wrangler/custom-builds/).
@@ -1004,7 +1004,7 @@ The following options are available under the `assets` key.
10041004
- `directory` <Type text="string" /> <MetaInfo text="optional" />
10051005

10061006
- Folder of static assets to be served.
1007-
- Not required if you're using the [Cloudflare Vite plugin](/workers/local-development/vite/), which will automatically point to the client build output.
1007+
- Not required if you're using the [Cloudflare Vite plugin](/workers/vite-plugin/), which will automatically point to the client build output.
10081008

10091009
- `binding` <Type text="string" /> <MetaInfo text="optional" />
10101010

@@ -1035,7 +1035,7 @@ assets = { directory = "./public", binding = "ASSETS", html_handling = "force-tr
10351035
## Bundling
10361036

10371037
:::note
1038-
Wrangler bundling is not applicable if you're using the [Cloudflare Vite plugin](/workers/local-development/vite/).
1038+
Wrangler bundling is not applicable if you're using the [Cloudflare Vite plugin](/workers/vite-plugin/).
10391039
:::
10401040

10411041
Wrangler can operate in two modes: the default bundling mode and `--no-bundle` mode.
@@ -1096,7 +1096,7 @@ See https://developers.cloudflare.com/workers/wrangler/bundling/ for more detail
10961096
## Local development settings
10971097

10981098
:::note
1099-
If you're using the [Cloudflare Vite plugin](/workers/local-development/vite/), you should use Vite's [server options]](https://vite.dev/config/server-options.html) instead.
1099+
If you're using the [Cloudflare Vite plugin](/workers/vite-plugin/), you should use Vite's [server options]](https://vite.dev/config/server-options.html) instead.
11001100
:::
11011101

11021102
You can configure various aspects of local development, such as the local protocol or port.
@@ -1143,7 +1143,7 @@ local_protocol = "http"
11431143
## Module Aliasing
11441144

11451145
:::note
1146-
If you're using the [Cloudflare Vite plugin](/workers/local-development/vite/), `alias` is replaced Vite's [`resolve.alias`](https://vite.dev/config/shared-options.html#resolve-alias).
1146+
If you're using the [Cloudflare Vite plugin](/workers/vite-plugin/), `alias` is replaced Vite's [`resolve.alias`](https://vite.dev/config/shared-options.html#resolve-alias).
11471147
:::
11481148

11491149
You can configure Wrangler to replace all calls to import a particular package with a module of your choice, by configuring the `alias` field:
@@ -1306,7 +1306,7 @@ This section describes a feature that can be implemented by frameworks and other
13061306

13071307
It is unlikely that an application developer will need to use this feature, but it is documented here to help you understand when Wrangler is using a generated configuration rather than the original, user's configuration.
13081308

1309-
For example, when you are using the [Cloudflare Vite plugin](/workers/local-development/vite/), it will generate a Wrangler configuration file when you run `vite build`, which is then used for preview and deployment.
1309+
For example, when you are using the [Cloudflare Vite plugin](/workers/vite-plugin/), it will generate a Wrangler configuration file when you run `vite build`, which is then used for preview and deployment.
13101310

13111311
:::
13121312

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

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,52 +5,52 @@ head: []
55
description: Use environments to create different configurations for the same Worker application.
66
---
77

8-
import { WranglerConfig } from "~/components";
8+
import { WranglerConfig, Render, Steps } from "~/components";
99

1010
Wrangler allows you to use environments to create different configurations for the same Worker application. Environments are configured in the Worker's [Wrangler configuration file](/workers/wrangler/configuration/).
11-
There is a default (top-level) environment and you can create named environments that provide environment-specific configuration.
11+
12+
When you create an environment, Cloudflare effectively creates a new Worker with the name `<top-level-name>-<environment-name>`. For example, a Worker project named `my-worker` with an environment `dev` would deploy as a Worker named `my-worker-dev`.
1213

1314
Review the following environments flow:
1415

16+
<Steps>
1517
1. Create a Worker, named `my-worker` for example.
1618
2. Create an environment, for example `dev`, in the Worker's [Wrangler configuration file](/workers/wrangler/configuration/), by adding a `[env.<ENV_NAME>]` section.
1719

18-
<WranglerConfig>
20+
<WranglerConfig>
1921

20-
```json
21-
{
22-
"name": "my-worker",
23-
"env": {
24-
"<ENV_NAME>": {
25-
// environment-specific configuration goes here
26-
}
27-
}
28-
}
29-
```
22+
```json
23+
{
24+
"name": "my-worker",
25+
"env": {
26+
"<ENV_NAME>": {
27+
// environment-specific configuration goes here
28+
}
29+
}
30+
}
31+
```
32+
</WranglerConfig>
3033

31-
</WranglerConfig>
34+
3. You can configure the `dev` environment with different values to the top-level environment. Refer [here](/workers/wrangler/configuration/#environments) for how different options are inherited - or not inherited - between environments.
35+
For example, to set a different route for a Worker in the `dev` environment:
3236

33-
3. You can configure the `dev` environment with different values to the top-level environment. Refer [here](/workers/wrangler/configuration/#environments) for how different options are inherited - or not inherited - between environments.
37+
<WranglerConfig>
3438

35-
For example, to set a different route for a Worker in the `dev` environment:
39+
```toml
40+
name = "your-worker"
41+
route = "example.com"
3642

37-
<WranglerConfig>
43+
[env.dev]
44+
route = "dev.example.com"
45+
```
3846

39-
```toml
40-
name = "your-worker"
41-
route = "example.com"
47+
</WranglerConfig>
4248

43-
[env.dev]
44-
route = "dev.example.com"
45-
```
49+
4. Environments are used with the `--env` or `-e` flag on Wrangler commands. For example, you can develop the Worker in the `dev` environment by running `npx wrangler dev -e=dev`, and deploy it with `npx wrangler deploy -e=dev`.
4650

47-
</WranglerConfig>
48-
4. Environments are used with the `--env` or `-e` flag on Wrangler commands. For example, you can develop the Worker in the `dev` environment by running `npx wrangler dev -e=dev`, and deploy it with `npx wrangler deploy -e=dev`.
51+
<Render file="vite-environments" />
4952

50-
:::note
51-
52-
Cloudflare effectively creates a new Worker for you when you create a Worker with an environment. Wrangler appends the environment name to the top-level name. For example, a Worker project named `my-worker` with an environment `dev` would deploy a Worker named `my-worker-dev`. You must use this name when referencing a Worker in a particular environment, for example in a [service binding](/workers/wrangler/configuration/#service-bindings).
53-
:::
53+
</Steps>
5454

5555
## Non-inheritable keys and environments
5656

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
{}
3+
---
4+
5+
:::note
6+
If you're using the [Cloudflare Vite plugin](/workers/vite-plugin/), you select a Wrangler environment at dev or build time via the `CLOUDFLARE_ENV` environment variable rather than the `--env` flag. Otherwise, environments are defined in your Wrangler config file as usual. For more detail on using Wrangler environments with the Cloudflare Vite plugin, refer to the [plugin documentation](/workers/vite-plugin/reference/cloudflare-environments/).
7+
:::

src/content/partials/workers/workers_sites.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44

55
:::caution[Use Workers Static Assets Instead]
66

7-
You should use [Workers Static Assets](/workers/static-assets/) to host full-stack applications instead of Workers Sites. It has been deprecated in Wrangler v4, and the [Cloudflare Vite plugin](/workers/local-development/vite) does not support Workers Sites. Do not use Workers Sites for new projects.
7+
You should use [Workers Static Assets](/workers/static-assets/) to host full-stack applications instead of Workers Sites. It has been deprecated in Wrangler v4, and the [Cloudflare Vite plugin](/workers/vite-plugin/) does not support Workers Sites. Do not use Workers Sites for new projects.
88
:::

0 commit comments

Comments
 (0)