23 lines
723 B
JavaScript
23 lines
723 B
JavaScript
const fs = require("fs");
|
|
const path = require("path");
|
|
|
|
const manifestPath = path.join(__dirname, "..", ".next", "server", "middleware-manifest.json");
|
|
const dir = path.dirname(manifestPath);
|
|
|
|
try {
|
|
if (!fs.existsSync(manifestPath)) {
|
|
fs.mkdirSync(dir, { recursive: true });
|
|
const payload = {
|
|
version: 2,
|
|
middleware: {},
|
|
functions: {},
|
|
sortedMiddleware: [],
|
|
clientInfo: [],
|
|
};
|
|
fs.writeFileSync(manifestPath, JSON.stringify(payload, null, 2));
|
|
console.log(`Created missing middleware manifest at ${manifestPath}`);
|
|
}
|
|
} catch (err) {
|
|
console.warn("Could not ensure middleware manifest (likely permissions). You can create it manually:", manifestPath, err?.message);
|
|
}
|