Skip to content

Commit 22f1a2b

Browse files
committed
some assets updates
1 parent fb44a14 commit 22f1a2b

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ The **assets directory** specified in your [Wrangler configuration file](/worker
5959

6060
</WranglerConfig>
6161

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.
64+
:::
65+
6266
By adding an [**assets binding**](/workers/static-assets/binding/#binding), you can directly fetch and serve assets within your Worker code.
6367

6468
```js {13}
@@ -83,7 +87,7 @@ export default {
8387

8488
By default, if a requested URL matches a file in the static assets directory, that file will always be served — without running Worker code. If no matching asset is found and a Worker is configured, the request will be processed by the Worker instead.
8589

86-
- If no Worker is set up, the [`not_found_handling`](/workers/static-assets/routing/#2-not_found_handling-1) setting in your Wrangler configuration determines what happens next. By default, a `404 Not Found` response is returned.
90+
- If no Worker is set up, the [`not_found_handling`](/workers/static-assets/routing/#not_found_handling-1) setting in your Wrangler configuration determines what happens next. By default, a `404 Not Found` response is returned.
8791

8892
- If a Worker is configured and a request does not match a static asset, the Worker will handle the request. The Worker can choose to pass the request to the asset binding (through `env.ASSETS.fetch()`), following the `not_found_handling` rules.
8993

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1001,7 +1001,7 @@ You can only configure one collection of assets per Worker.
10011001

10021002
The following options are available under the `assets` key.
10031003

1004-
- `directory` <Type text="string" /> <MetaInfo text="required" />
1004+
- `directory` <Type text="string" /> <MetaInfo text="optional" />
10051005

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

0 commit comments

Comments
 (0)