Skip to content

Commit

Permalink
fix(gatsby-plugin-manifest): Only reassign start_url if it already ex…
Browse files Browse the repository at this point in the history
…ists (#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
  • Loading branch information
trevorblades authored Jan 29, 2020
1 parent e22e648 commit dd96604
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/gatsby-plugin-manifest/src/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit dd96604

Please sign in to comment.