Skip to content

Commit

Permalink
Merge pull request #222 from Niels-IO/fixRemoteImageFS
Browse files Browse the repository at this point in the history
fix: Edit optimizeImages.ts to handle missing remote image folder
  • Loading branch information
Niels-IO authored Jun 10, 2024
2 parents 3c083f6 + 4a5c72f commit d3dee22
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/optimizeImages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,11 @@ const nextImageExportOptimizer = async function () {
);

// we clear all images in the remote image folder that are not in the remoteImageURLs array
const allFilesInRemoteImageFolder: string[] = fs.readdirSync(
const allFilesInRemoteImageFolder: string[] = fs.existsSync(
folderNameForRemoteImages
);
)
? fs.readdirSync(folderNameForRemoteImages)
: [];
const encodedRemoteImageURLs = remoteImageURLs.map((url: string) =>
urlToFilename(url)
);
Expand Down

0 comments on commit d3dee22

Please sign in to comment.