I am playing with Angular & Workers and have run into a problem I can’t seem to figure out.
This is my worker code:
import { getAssetFromKV, serveSinglePageApp } from ‘@cloudflare/kv-asset-handler’
addEventListener(“fetch”, event =>
{
event.respondWith(handleEvent(event));
})async function handleEvent(event)
{
try { return await getAssetFromKV(event, { mapRequestToAsset: serveSinglePageApp }); }
catch (err) { return new Response(err.stack || err); }
}
Visiting the deployed site, it shows this:
TypeError: i.mapRequestToAsset is not a function at worker.js:1:35947 at worker.js:1:36975 at worker.js:1:37048
My code seems to match the example here.
If I remove the options from getAssetFromKV, everything works fine, so what is the problem with specifying options in this case?