Gatsby depends on gatsby-link implicitly
See original GitHub issueI’m new to Gatsby and experimenting with migrating a single page site to it. Because I only need a single page I have no need for gatsby-link
. However, after removing the package (which was included by the default gatsby new
starter) I get the following error:
ERROR Failed to compile with 1 errors 9:21:45 AM
This dependency was not found:
* gatsby-link in ./.cache/dev-404-page.js
To install it, you can run: npm install --save gatsby-link
It’s clear to me that Gatsby’s internal development 404 page relies on gatsby-link
so I should keep it in my own package.json
. However, I found it surprising that gatsby-link
isn’t just included in the gatsby
package because it seems that every single Gatsby project will use this in development. Alternatively, gatsby-link
could be listed as a peerDependency
in package.json
, giving users a hint to include it manually, or the 404 page could be rewritten to not use the plugin. Another idea is that this could be an internal plugin with the Link
component exported somewhere in the gatsby
module or a submodule like gatsby/link
, leading to a similar developer experience but without the extra npm package.
To be clear, I’m specifically referring to the cyclical dependency between the gatsby
and gatsby-link
packages and the developer experience around using the gatsby
package without any dependent packages. I’m not necessarily suggesting that Gatsby should force users to use gatsby-link
by default, I like that this functionality is more explicitly provided in a separate package.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (5 by maintainers)
Top GitHub Comments
Agreed — it should have always been part of
gatsby
. As part of v2 we’ll be combining the two.I have the same problem:
ERROR Failed to compile with 1 errors
This dependency was not found:
the trouble with me is I’m newer than you guys and I don’t understand what you did to fix the problem? I’ve tried npm install --save gatsby-link and npm install -g gatsby link. I’ve installed a bunch of webpack stuff. I keep getting the same error?
I can’t understand from above, how you fixed it?
Also my dependencies looks like this so I have gatsby-link: “dependencies”: { “babel-plugin-styled-components”: “^1.5.1”, “gatsby”: “^1.9.247”, “gatsby-link”: “^1.6.40”, “gatsby-plugin-react-helmet”: “^2.0.10”, “gatsby-plugin-styled-components”: “^2.0.11”, “react-helmet”: “^5.2.0”, “styled-components”: “^3.2.5”