Skip to content
This repository was archived by the owner on May 10, 2021. It is now read-only.

Commit e343288

Browse files
add check if pages-manifest exists before reading (#147)
1 parent aa7723b commit e343288

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/helpers/getPagesManifest.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
const { join } = require("path");
2-
const { readJSONSync } = require("fs-extra");
2+
const { existsSync, readJSONSync } = require("fs-extra");
33
const { NEXT_DIST_DIR } = require("../config");
44

55
const getPagesManifest = () => {
6-
const contents = readJSONSync(
7-
join(NEXT_DIST_DIR, "serverless", "pages-manifest.json")
8-
);
6+
const manifestPath = join(NEXT_DIST_DIR, "serverless", "pages-manifest.json");
7+
if (!existsSync(manifestPath)) return {};
8+
const contents = readJSONSync(manifestPath);
99
// Next.js mistakenly puts backslashes in certain paths on Windows, replace
1010
Object.entries(contents).forEach(([key, value]) => {
1111
contents[key] = value.replace(/\\/g, "/");

0 commit comments

Comments
 (0)