const fs = require("fs"); const path = require("path"); const distPath = path.resolve(__dirname, "dist"); const manifestPath = path.join(distPath, ".vite/manifest.json"); const outputPath = path.join(distPath, "index.html"); fs.readFile(manifestPath, { encoding: "utf8" }, (err, data) => { if (err) { return console.error("Failed to read manifest:", err); } const manifest = JSON.parse(data); /** @type {{ file: string; name: string; src: string; isEntry: bool; css: string[]; } []} */ const assets = Object.values(manifest); console.log(`Generate custom index.html from ${manifestPath} ...`); // Start with a basic HTML structure let htmlContent = `