ItsWendell
05/20/2023, 10:09 PM/public/some-temp-image.png
? We use getAssetFromKV:
return await getAssetFromKV(
{
request: ctx.req.raw,
waitUntil: ctx.executionCtx.waitUntil.bind(ctx.executionCtx),
},
{
ASSET_NAMESPACE: ctx.env.__STATIC_CONTENT,
mapRequestToAsset: (req) => {
const url = new URL(req.url);
url.pathname = url.pathname.replace(/^\/public/, "");
return new Request(url.toString(), req);
},
},
);
} catch (e) {
if (e instanceof Error) {
console.error(e);
if ("status" in e) {
if (e.status === 404) {
return ctx.notFound();
}
}
}
throw e;
}
Can we skip workers sites from adding these hashes?James
05/20/2023, 10:14 PMsome-temp-image.[hash].png
for example, but you can serve that image at some-temp-image.png
without the hash just fine. That's pretty much exactly the point of what kv-asset-handler
does 🤔 Is there something I'm missing or you can clarify?ItsWendell
05/20/2023, 10:19 PMimport manifestJSON from "__STATIC_CONTENT_MANIFEST";
For the typescript people, I also added the following declaration file:
ts
declare module "__STATIC_CONTENT_MANIFEST" {
export default string;
}
James
05/20/2023, 10:22 PMItsWendell
05/20/2023, 10:25 PM