Skip to content

Commit a2178af

Browse files
committed
note when not applicable to vite plugin
1 parent eed960b commit a2178af

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" />
@@ -988,6 +1006,7 @@ The following options are available under the `assets` key.
9881006
- `directory` <Type text="string" /> <MetaInfo text="required" />
9891007

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

9921011
- `binding` <Type text="string" /> <MetaInfo text="optional" />
9931012

@@ -1017,6 +1036,10 @@ assets = { directory = "./public", binding = "ASSETS", html_handling = "force-tr
10171036

10181037
## Bundling
10191038

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

10751098
## Local development settings
10761099

1100+
Q: is this replaced by vite's server options?
1101+
10771102
You can configure various aspects of local development, such as the local protocol or port.
10781103

10791104
- `ip` <Type text="string" /> <MetaInfo text="optional" />
@@ -1117,10 +1142,10 @@ local_protocol = "http"
11171142

11181143
## Module Aliasing
11191144

1120-
<Details header="⚡ Vite plugin">
1121-
This is replaced "resolve.alias" in Vite - refer to the Vite documentation for
1122-
usage: https://vite.dev/config/shared-options.html#resolve-alias".
1123-
</Details>
1145+
:::note
1146+
If you're using the [Cloudflare Vite plugin](/workers/local-development/vite/), `alias` is replaced Vite's `resolve.alias` - refer to the [Vite
1147+
documentation](https://vite.dev/config/shared-options.html#resolve-alias).
1148+
:::
11241149

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

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

12001225
- 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).
1226+
- Not applicable if you're using the [Cloudflare Vite plugin](/workers/local-development/vite/).
12011227

12021228
Example:
12031229

@@ -1282,6 +1308,8 @@ This section describes a feature that can be implemented by frameworks and other
12821308

12831309
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.
12841310

1311+
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.
1312+
12851313
:::
12861314

12871315
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)