From 6810850702afd834ca99f481f24036737c1fe5ba Mon Sep 17 00:00:00 2001 From: Trevor Blades Date: Wed, 29 Jan 2020 12:42:54 -0800 Subject: [PATCH 1/2] 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. --- 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..94e3b0a2aa430 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( From 0488a587b9bf806d4e95ea58213ae965420b1a7f Mon Sep 17 00:00:00 2001 From: Trevor Blades Date: Wed, 29 Jan 2020 12:59:09 -0800 Subject: [PATCH 2/2] Fix linting issue --- packages/gatsby-plugin-manifest/src/gatsby-node.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/gatsby-plugin-manifest/src/gatsby-node.js b/packages/gatsby-plugin-manifest/src/gatsby-node.js index 94e3b0a2aa430..30cc7072e07d9 100644 --- a/packages/gatsby-plugin-manifest/src/gatsby-node.js +++ b/packages/gatsby-plugin-manifest/src/gatsby-node.js @@ -226,7 +226,7 @@ const makeManifest = async ({ src: slash(path.join(basePath, icon.src)), } }) - + if (manifest.start_url) { manifest.start_url = path.posix.join(basePath, manifest.start_url) }