Skip to content

Commit 1a64e53

Browse files
committed
PR feedback
1 parent dfd92f4 commit 1a64e53

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/content/changelog/workers/2025-06-27-vite-plugin-full-assets-support.mdx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,31 @@ products:
66
date: 2025-06-27T12:00:00Z
77
---
88

9-
All of Vite's [static asset handling](https://vite.dev/guide/assets) features are now supported in your Worker as well as in your frontend.
9+
You can now use any of Vite's [static asset handling](https://vite.dev/guide/assets) features in your Worker as well as in your frontend.
1010
These include importing assets as URLs, importing as strings and importing from the `public` directory as well as inlining assets.
1111

1212
Additionally, assets imported as URLs in your Worker are now automatically moved to the client build output.
1313

14-
Here's an example that fetches an imported asset using the [assets binding](/workers/static-assets/binding/#binding) and modifies the response.
14+
Here is an example that fetches an imported asset using the [assets binding](/workers/static-assets/binding/#binding) and modifies the response.
1515

1616
```ts
17+
// Import the asset URL
18+
// This returns the resolved path in development and production
1719
import myImage from "./my-image.png";
1820

1921
export default {
2022
async fetch(request, env) {
23+
// Fetch the asset using the binding
2124
const response = await env.ASSETS.fetch(new URL(myImage, request.url));
25+
// Create a new `Response` object that can be modified
2226
const modifiedResponse = new Response(response.body, response);
27+
// Add an additional header
2328
modifiedResponse.headers.append("my-header", "imported-asset");
2429

30+
// Return the modfied response
2531
return modifiedResponse;
2632
},
2733
};
2834
```
2935

30-
See [Static Assets](/workers/vite-plugin/reference/static-assets/) in the Vite plugin docs for more info.
36+
Refer to [Static Assets](/workers/vite-plugin/reference/static-assets/) in the Cloudflare Vite plugin docs for more info.

0 commit comments

Comments
 (0)