0

I am working on a Next.js project with Typescript. I fetch content from Contentful CMS. After fetching content I want to convert rich-text it to HTML code. for that purpose, I follow the instruction of contentful. link- https://www.contentful.com/developers/docs/javascript/tutorials/rendering-contentful-rich-text-with-javascript/

In order to install the contentful/rich-text-react-renderer' package with npm. I face an error when importing the package in my component.

Module not found: Can't resolve '@contentful/rich-text-react-renderer'
  2 | import Hero from "@/component/Hero";
  3 | import { client } from "@/component/client";
> 4 | import {documentToReactComponents} from '@contentful/rich-text-react-renderer';
  5 | 

That should give me the string like this-

<p class="align-center"><span class="bold">Hello</span><u> world!</u></p>
  • Hey Osama, can you provide more details to reproduce this? I created a Next.js TypeScript project and everything seems to work for me. – harshil1712 Apr 11 '23 at 10:16

0 Answers0