Skip to content

Instantly share code, notes, and snippets.

@MaikelVeen
Last active January 9, 2021 21:54
Show Gist options
  • Save MaikelVeen/036dd86b2f71678151321f4ff483ab79 to your computer and use it in GitHub Desktop.
Save MaikelVeen/036dd86b2f71678151321f4ff483ab79 to your computer and use it in GitHub Desktop.
Reading the manifest file.
const ReadManifestFile = (basePath: string): object => {
const routes_manifest_path = path.join(basePath + '/.next/server/pages-manifest.json');
// Read from the file
if (fs.existsSync(routes_manifest_path)) {
const raw_json = fs.readFileSync(routes_manifest_path);
return JSON.parse(raw_json.toString());
} else return null;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment