Skip to content

Commit 49912da

Browse files
committed
note when not applicable to vite plugin
1 parent faa2768 commit 49912da

File tree

2 files changed

+33
-6
lines changed

2 files changed

+33
-6
lines changed

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

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ 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).
65+
6466
## Top-level only keys
6567

6668
Top-level keys apply to the Worker as a whole (and therefore all environments). They cannot be defined within named environments.
@@ -80,6 +82,7 @@ Top-level keys apply to the Worker as a whole (and therefore all environments).
8082
- `site` <Type text="object" /> <MetaInfo text="optional deprecated" />
8183

8284
- 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/).
8386

8487
## Inheritable keys
8588

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

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

133137
- `triggers` <Type text="object" /> <MetaInfo text="optional" />
134138

@@ -137,35 +141,43 @@ At a minimum, the `name`, `main` and `compatibility_date` keys are required to d
137141
- `rules` <Type text="Rule" /> <MetaInfo text="optional" />
138142

139143
- 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/).
140145

141146
- `build` <Type text="Build" /> <MetaInfo text="optional" />
142147

143148
- 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/).
144150

145151
- `no_bundle` <Type text="boolean" /> <MetaInfo text="optional" />
146152

147153
- 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/).
148155

149156
- `find_additional_modules` <Type text="boolean" /> <MetaInfo text="optional" />
150157

151158
- If true then Wrangler will traverse the file tree below `base_dir`.
152159
Any files that match `rules` will be included in the deployed Worker.
153160
Defaults to true if `no_bundle` is true, otherwise false.
154161
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/).
155163

156164
- `base_dir` <Type text="string" /> <MetaInfo text="optional" />
157165

158166
- 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/).
159168

160169
- `preserve_file_names` <Type text="boolean" /> <MetaInfo text="optional" />
161170

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

166176
- `minify` <Type text="boolean" /> <MetaInfo text="optional" />
167177

168178
- 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` - refer to the [Vite
180+
documentation](https://vite.dev/config/build-options.html#build-minify).
169181

170182
- `logpush` <Type text="boolean" /> <MetaInfo text="optional" />
171183

@@ -189,6 +201,8 @@ Non-inheritable keys are configurable at the top-level, but cannot be inherited
189201
- `define` <Type text="Record<string, string>" /> <MetaInfo text="optional" />
190202

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

193207
- `vars` <Type text="object" /> <MetaInfo text="optional" />
194208

@@ -369,6 +383,10 @@ head_sampling_rate = 0.1 # 10% of requests are logged
369383

370384
## Custom builds
371385

386+
::: note
387+
Not applicable if you're using the [Cloudflare Vite plugin](/workers/local-development/vite/).
388+
:::
389+
372390
You can configure a custom build step that will be run before your Worker is deployed. Refer to [Custom builds](/workers/wrangler/custom-builds/).
373391

374392
- `command` <Type text="string" /> <MetaInfo text="optional" />
@@ -985,6 +1003,7 @@ The following options are available under the `assets` key.
9851003
- `directory` <Type text="string" /> <MetaInfo text="required" />
9861004

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

9891008
- `binding` <Type text="string" /> <MetaInfo text="optional" />
9901009

@@ -1014,6 +1033,10 @@ assets = { directory = "./public", binding = "ASSETS", html_handling = "force-tr
10141033

10151034
## Bundling
10161035

1036+
::: note
1037+
Wrangler bundling is not applicable if you're using the [Cloudflare Vite plugin](/workers/local-development/vite/).
1038+
:::
1039+
10171040
Wrangler can operate in two modes: the default bundling mode and `--no-bundle` mode.
10181041
In bundling mode, Wrangler will traverse all the imports of your code and generate a single JavaScript "entry-point" file.
10191042
Imported source code is "inlined/bundled" into this entry-point file.
@@ -1071,6 +1094,8 @@ See https://developers.cloudflare.com/workers/wrangler/bundling/ for more detail
10711094

10721095
## Local development settings
10731096

1097+
Q: is this replaced by vite's server options?
1098+
10741099
You can configure various aspects of local development, such as the local protocol or port.
10751100

10761101
- `ip` <Type text="string" /> <MetaInfo text="optional" />
@@ -1114,10 +1139,10 @@ local_protocol = "http"
11141139

11151140
## Module Aliasing
11161141

1117-
<Details header="⚡ Vite plugin">
1118-
This is replaced "resolve.alias" in Vite - refer to the Vite documentation for
1119-
usage: https://vite.dev/config/shared-options.html#resolve-alias".
1120-
</Details>
1142+
:::note
1143+
If you're using the [Cloudflare Vite plugin](/workers/local-development/vite/), `alias` is replaced Vite's `resolve.alias` - refer to the [Vite
1144+
documentation](https://vite.dev/config/shared-options.html#resolve-alias).
1145+
:::
11211146

11221147
You can configure Wrangler to replace all calls to import a particular package with a module of your choice, by configuring the `alias` field:
11231148

@@ -1195,6 +1220,7 @@ In many cases, this allows you to work provide just enough of an API to make a d
11951220
- `upload_source_maps` <Type text="boolean" />
11961221

11971222
- When `upload_source_maps` is set to `true`, Wrangler will automatically generate and upload source map files when you run [`wrangler deploy`](/workers/wrangler/commands/#deploy) or [`wrangler versions deploy`](/workers/wrangler/commands/#deploy-2).
1223+
- Not applicable if you're using the [Cloudflare Vite plugin](/workers/local-development/vite/).
11981224

11991225
Example:
12001226

@@ -1279,6 +1305,8 @@ This section describes a feature that can be implemented by frameworks and other
12791305

12801306
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.
12811307

1308+
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+
12821310
:::
12831311

12841312
Some framework tools, or custom pre-build processes, generate a modified Wrangler configuration to be used to deploy the Worker code.
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
---
22
{}
3-
43
---
54

65
:::caution[Use Workers Static Assets Instead]
76

8-
You should use [Workers Static Assets](/workers/static-assets/) to host full-stack applications instead of 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/local-development/vite) does not support Workers Sites. Do not use Workers Sites for new projects.
98
:::

0 commit comments

Comments
 (0)