From 35eacd75106f4668ee083d7c9904a11ff7a61d34 Mon Sep 17 00:00:00 2001 From: goofytroopy Date: Fri, 19 Oct 2018 00:07:01 +0200 Subject: [PATCH] Update gatsby-node.js (#9211) Deleting directory make gatsby crash. When working with markdownfiles and deleting a directory the developer server will crash. The same check that is for files should also be on directories, otherwise it might try to delete a directory that does not exist. --- packages/gatsby-source-filesystem/src/gatsby-node.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/gatsby-source-filesystem/src/gatsby-node.js b/packages/gatsby-source-filesystem/src/gatsby-node.js index 9cdcd27a51621..a5dc1edae050b 100644 --- a/packages/gatsby-source-filesystem/src/gatsby-node.js +++ b/packages/gatsby-source-filesystem/src/gatsby-node.js @@ -177,7 +177,9 @@ See docs here - https://www.gatsbyjs.org/packages/gatsby-source-filesystem/ reporter.info(`directory deleted at ${path}`) } const node = getNode(createNodeId(path)) - deleteNode({ node }) + if (node) { + deleteNode({ node }) + } }) return new Promise((resolve, reject) => {