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:
It returns
const cache = caches?.default;
undefined
.
Is the Cache API not usable with Pages?4 Replies
It is, but not when using svelte dev
You have to use wrangler dev
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'
.It should be? Maybe SvelteKit is mangling it?
It seems it might be a mistake in my coding. I'll check it.