28 lines
911 B
JavaScript
Raw Normal View History

#!/usr/bin/env node
// Ensure dev-time Next.js manifests exist to avoid noisy ENOENT errors
import { mkdirSync, existsSync, writeFileSync } from "fs";
import { join } from "path";
const root = new URL("..", import.meta.url).pathname; // apps/portal
const nextDir = join(root, ".next");
const routesManifestPath = join(nextDir, "routes-manifest.json");
try {
mkdirSync(nextDir, { recursive: true });
if (!existsSync(routesManifestPath)) {
const minimalManifest = {
version: 5,
pages404: true,
basePath: "",
redirects: [],
rewrites: { beforeFiles: [], afterFiles: [], fallback: [] },
headers: [],
};
writeFileSync(routesManifestPath, JSON.stringify(minimalManifest, null, 2));
console.log("[dev-prep] Created minimal .next/routes-manifest.json");
}
} catch (err) {
console.warn("[dev-prep] Failed to prepare Next dev files:", err?.message || err);
}