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

Commit 690dd4b

Browse files
check existence of dirs before reading them in file tracking logic (#150)
1 parent 6057c10 commit 690dd4b

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

lib/helpers/handleFileTracking.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,14 @@ const handleFileTracking = ({ functionsPath, publishPath }) => {
5656

5757
// this callback will run at the end of nextOnNetlify()
5858
const trackNewFiles = () => {
59-
const functionsAfterRun = isConfiguredFunctionsDir
60-
? readdirSync(functionsPath)
61-
: functionsBeforeRun;
62-
const publishAfterRun = isConfiguredPublishDir
63-
? readdirSync(publishPath)
64-
: publishBeforeRun;
59+
const functionsAfterRun =
60+
isConfiguredFunctionsDir && existsSync(functionsPath)
61+
? readdirSync(functionsPath)
62+
: functionsBeforeRun;
63+
const publishAfterRun =
64+
isConfiguredPublishDir && existsSync(publishPath)
65+
? readdirSync(publishPath)
66+
: publishBeforeRun;
6567
const getDifference = (before, after) =>
6668
after.filter((filePath) => !before.includes(filePath));
6769
const newFunctionsFiles = getDifference(

0 commit comments

Comments
 (0)