Skip to content

Commit 91dc5bd

Browse files
committed
Use synchronous calls
1 parent 8e20be6 commit 91dc5bd

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

index.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@ts-check
2-
const { exists, readFileSync } = require("fs");
2+
const { exists, existsSync, readFileSync } = require("fs");
33
const path = require("path");
44

55
const PrerenderSPAPlugin = require("prerender-spa-plugin");
@@ -17,11 +17,9 @@ function chain(api, projectOptions) {
1717
try {
1818
options = pickle(projectOptions, CONFIG_OBJ_PATH);
1919
} catch {
20-
exists("./.prerender-spa.json", exists => {
21-
if (exists) {
22-
Object.assign(options, JSON.parse(readFileSync("./.prerender-spa.json").toString("utf-8")));
23-
}
24-
});
20+
if (existsSync) {
21+
options = JSON.parse(readFileSync("./.prerender-spa.json").toString("utf-8"));
22+
}
2523
}
2624
if (options.onlyProduction && process.env.NODE_ENV !== "production") {
2725
return;

0 commit comments

Comments
 (0)