You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/workers/static-assets/index.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -60,7 +60,7 @@ The **assets directory** specified in your [Wrangler configuration file](/worker
60
60
</WranglerConfig>
61
61
62
62
:::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.
64
64
:::
65
65
66
66
By adding an [**assets binding**](/workers/static-assets/binding/#binding), you can directly fetch and serve assets within your Worker code.
Copy file name to clipboardExpand all lines: src/content/docs/workers/wrangler/commands.mdx
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -424,6 +424,7 @@ As of Wrangler v3.2.0, `wrangler dev` is supported by any Linux distributions pr
424
424
- Skip Wrangler's build steps. Particularly useful when using custom builds. Refer to [Bundling](https://developers.cloudflare.com/workers/wrangler/bundling/) for more information.
@@ -515,6 +516,7 @@ None of the options for this command are required. Also, many can be set in your
515
516
- Skip Wrangler's build steps. Particularly useful when using custom builds. Refer to [Bundling](https://developers.cloudflare.com/workers/wrangler/bundling/) for more information.
Copy file name to clipboardExpand all lines: src/content/docs/workers/wrangler/configuration.mdx
+17-17Lines changed: 17 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -61,7 +61,7 @@ The majority of keys are inheritable, meaning that top-level configuration can b
61
61
62
62
Further, there are a few keys that can _only_ appear at the top-level.
63
63
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
+
<Renderfile="vite-environments" />
65
65
66
66
## Top-level only keys
67
67
@@ -82,7 +82,7 @@ Top-level keys apply to the Worker as a whole (and therefore all environments).
- 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/).
- 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/).
- 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).
- 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).
- 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.
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/).
1039
1039
:::
1040
1040
1041
1041
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
1096
1096
## Local development settings
1097
1097
1098
1098
:::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.
1100
1100
:::
1101
1101
1102
1102
You can configure various aspects of local development, such as the local protocol or port.
@@ -1143,7 +1143,7 @@ local_protocol = "http"
1143
1143
## Module Aliasing
1144
1144
1145
1145
:::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).
1147
1147
:::
1148
1148
1149
1149
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
1306
1306
1307
1307
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.
1308
1308
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.
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`.
12
13
13
14
Review the following environments flow:
14
15
16
+
<Steps>
15
17
1. Create a Worker, named `my-worker` for example.
16
18
2. Create an environment, for example `dev`, in the Worker's [Wrangler configuration file](/workers/wrangler/configuration/), by adding a `[env.<ENV_NAME>]` section.
17
19
18
-
<WranglerConfig>
20
+
<WranglerConfig>
19
21
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>
30
33
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:
32
36
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>
34
38
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"
36
42
37
-
<WranglerConfig>
43
+
[env.dev]
44
+
route = "dev.example.com"
45
+
```
38
46
39
-
```toml
40
-
name = "your-worker"
41
-
route = "example.com"
47
+
</WranglerConfig>
42
48
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`.
46
50
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
+
<Renderfile="vite-environments" />
49
52
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).
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/).
Copy file name to clipboardExpand all lines: src/content/partials/workers/workers_sites.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,5 +4,5 @@
4
4
5
5
:::caution[Use Workers Static Assets Instead]
6
6
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.
0 commit comments