Usage of Cache API with Pages

I am developing with SvelteKit on Pages, and I would like to utilize the Cache API available in Workers. However, when I write the following code on the server side of SvelteKit: const cache = caches?.default; It returns undefined. Is the Cache API not usable with Pages?
4 Replies
Hello, I’m Allie!
It is, but not when using svelte dev You have to use wrangler dev
うつぼP
うつぼP9mo ago
The result mentioned above occurs not on the Svelte dev server, but on the site deployed to Cloudflare. I apologize for the mistake. The correct sample code should be: typeof caches This returns 'undefined'.
Hello, I’m Allie!
It should be? Maybe SvelteKit is mangling it?
うつぼP
うつぼP9mo ago
It seems it might be a mistake in my coding. I'll check it.
Want results from more Discord servers?
Add your server