Closed yusukebe closed 4 months ago
This is closed by #2583
What if I was never using "cloudflare sites" and instead just wanted to serve some static assets from a worker?
What if I was never using "cloudflare sites" and instead just wanted to serve some static assets from a worker?
Use R2 with Cache API. Here's an example: https://github.com/daangn/websites/blob/main/_workers/about-daangn-com-production/functions/serve.ts
In most cases even this is not necessary. Using Cloudflare Pages as-is does not add any additional cost for Functions and R2 calls.
I need this for my heavily customized build-deployment pipeline.
Or you can use import
, if you have a small number of files you want to publish:
https://developers.cloudflare.com/workers/wrangler/configuration/#importing-assets-within-a-worker
Cloudflare Workers Site, which is used in
serveStatic
inhono/cloudflare-workers
, is now deprecated.https://developers.cloudflare.com/workers/configuration/sites/
If you want to create an application that serves asset files, you must use Cloudflare Pages. So, following this, we have to make
serveStatic
inhono/cloudflare-workers
deprecated.