contentful / rich-text

Libraries for handling and rendering Rich Text 📄
MIT License
547 stars 108 forks source link

Gatsby build renderRichText exception with embedded resources #220

Open Prichmondo opened 3 years ago

Prichmondo commented 3 years ago

I have recently updated gatsby-source-contentful to the version 5. In order to manage rich-text field render I replaced the previous function with the new renderRichText. I had to fix around all the graphql queries to replace json field with the raw, including declaration for all the embedded resources.

In this way I fixed dev mode, which is working fine now.

I still have an issue with gastby build though: renderRichText fails in rendering embedded resources:

` 257 | } 258 | // dates

259 | if (object instanceof realm.Date) { | ^ 260 | return new Constructor(object.getTime()); 261 | } 262 | // regexps`

WebpackError: TypeError: Right-hand side of 'instanceof' is not an object

AGAIN, I don't get this issue in dev-mode

DanweDE commented 3 years ago

Hi @Prichmondo! Please make sure to go through our change log when upgrading to a new major version to be aware of breaking changes. Specifically this entry could be of interest to you.

For documentation on renderRichText() please see documentation on rich-text-react-renderer which is also applicable to gatsby-source-contentful/rich-text as stated in this Contentful / Gatsby guide

I still have an issue with gastby build though: renderRichText fails in rendering embedded resources:

Did you already check out above documentation to properly render embedded resources? Would you mind pasting your code or perhaps even a codesandbox example?