From dd96604b91227a281df279626ae0d34002d89436 Mon Sep 17 00:00:00 2001 From: Trevor Blades Date: Wed, 29 Jan 2020 13:34:23 -0800 Subject: [PATCH] fix(gatsby-plugin-manifest): Only reassign start_url if it already exists (#21012) * Only reassign start_url if it already exists Currently, I'm seeing the following error coming from `gatsby-plugin-manifest` when I'm using only the `icon` option: ``` The "path" argument must be of type string. Received type undefined ``` This happens because the `start_url` option is undefined unless set by the user, yet we're passing it as an argument to `path.posix.join`, which expects each argument to be a string. This change adds a condition around the line reassigning `manifest.start_url` to make sure it exists first. * Fix linting issue --- packages/gatsby-plugin-manifest/src/gatsby-node.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/gatsby-plugin-manifest/src/gatsby-node.js b/packages/gatsby-plugin-manifest/src/gatsby-node.js index 97b80d4f3a300..30cc7072e07d9 100644 --- a/packages/gatsby-plugin-manifest/src/gatsby-node.js +++ b/packages/gatsby-plugin-manifest/src/gatsby-node.js @@ -226,7 +226,10 @@ const makeManifest = async ({ src: slash(path.join(basePath, icon.src)), } }) - manifest.start_url = path.posix.join(basePath, manifest.start_url) + + if (manifest.start_url) { + manifest.start_url = path.posix.join(basePath, manifest.start_url) + } //Write manifest fs.writeFileSync(