Skip to content

Commit 6a49135

Browse files
committed
note when not applicable to vite plugin
1 parent db991a8 commit 6a49135

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

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

9871006
- `binding` <Type text="string" /> <MetaInfo text="optional" />
9881007

@@ -1012,6 +1031,10 @@ assets = { directory = "./public", binding = "ASSETS", html_handling = "force-tr
10121031

10131032
## Bundling
10141033

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

10701093
## Local development settings
10711094

1095+
Q: is this replaced by vite's server options?
1096+
10721097
You can configure various aspects of local development, such as the local protocol or port.
10731098

10741099
- `ip` <Type text="string" /> <MetaInfo text="optional" />
@@ -1112,10 +1137,10 @@ local_protocol = "http"
11121137

11131138
## Module Aliasing
11141139

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

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

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

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

11971223
Example:
11981224

@@ -1277,6 +1303,8 @@ This section describes a feature that can be implemented by frameworks and other
12771303

12781304
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.
12791305

1306+
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.
1307+
12801308
:::
12811309

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