Open HexaCubist opened 1 year ago
Would also benefit from having this feature implemented. Currently patching it by running a script after building the application.
package.json:
"scripts": {
"build": "vite build && node patch-manifest.js",
// patch-manifest.js
import * as fs from 'fs';
const manifestPath = '.netlify/edge-functions/manifest.json';
try {
const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
manifest.functions = manifest.functions?.map((item) => ({ ...item, cache: 'manual' }));
const patchedManifest = JSON.stringify(manifest, null, 0);
fs.writeFileSync(manifestPath, patchedManifest, 'utf8');
console.log('Successfully patched manifest.json cache field.');
} catch (error) {
console.error(`Error patching manifest.json: ${error}`);
}
Describe the problem
One feature of Netlify edge functions is the ability to cache responses, described here: https://docs.netlify.com/edge-functions/optional-configuration/#response-caching
This requires a small change to the manifest to indicate manual caching control:
Describe the proposed solution
From what I understand, if the adapter allowed some level of configurability of the manifest output it would be possible to enable caching here:
https://github.com/sveltejs/kit/blob/c9a99b6c911c2ea9c919946aaada4f44293bdb75/packages/adapter-netlify/index.js#L116
Alternatives considered
No response
Importance
would make my life easier
Additional Information
No response