Closed neo01124 closed 4 years ago
I've created a starter at https://github.com/nehalist/gatsby-starter-nehalem - this includes a shadowing example. Using the starter should make it easier to get started :)
Thanks @nehalist. I've reproduced the same error (as Log 1 above) with the starter theme.
Steps:
gatsby new your-site-name https://github.com/nehalist/gatsby-starter-nehalem
. gatsby-develop
works.cd your-site-name && cp ./node_modules/@nehalist/gatsby-theme-nehalem/src/* ./src/@nehalist/gatsby-theme-nehalem
- basically copying everything from the theme's src to the site's src.gatsby clean && gatsby develop
fails with the following error.Failed to compile
GraphQL Error There was an error while compiling your site's GraphQL queries.
Error: RelayParser: Encountered duplicate defintitions for one or more documents: each document must have a unique name. Duplicated documents:
- Tags
- MetadataQuery
- PrimaryTag
This error occurred during the build time and cannot be dismissed.
Questions:
Seems like Gatsby is pretty unhappy with shadowed components using graphql queries which use the same name as their parents.
To fix this change the queries accordingly. The queries are located in:
src/@nehalist/gatsby-theme-nehalem/templates/post.tsx#312
src/@nehalist/gatsby-theme-nehalem/components/tag-list/index.tsx#19
src/@nehalist/gatsby-theme-nehalem/components/bio/index.tsx#35
On these lines you should find the queries, e.g. query MetaQuery
or query Tags
. Simply rename them to something like ShadowedMetaQuery
, ShadowedTags
- or whatever you want, just so that they have a different name that their parents.
I suppose this is fixed by now, hence closing this issue.
Hi @nehalist Thanks for this awesome theme! It has all the things I was looking for in such a theme - search, toc, tags, seo, etc.
I'm running into problems setting up shadowing. Steps
gatsby new tmp && cd tmp
yarn add @nehalist/gatsby-theme-nehalem
gatsby develop
works i.e. get the site working on localhost:8000 without errors. Did this by following https://nehalem.netlify.app/getting-started and adding siteMetadata.mkdir ./src/@nehalist/gatsby-theme-nehalem
cp node_modules/@nehalist/gatsby-theme-nehalem/src/* ./src/@nehalist/gatsby-theme-nehalem
- basically copying everything from the theme's src to the site's src.gatsby clean && gatsby develop
- This fails with Log 1 below.import { Bio } from "@nehalist/gatsby-theme-nehalem";
format and rerun clean & develop. That throws a different error - Log 2 belowQuestions:
Thanks!
Log 1
Log 2