prism-react-renderer icon indicating copy to clipboard operation
prism-react-renderer copied to clipboard

code highlighting does not work in nextjs dev environment

Open frostzt opened this issue 2 years ago • 2 comments

The problem

I am trying to use prism-react-renderer with Nextjs and Chakra-UI, however when I run next dev which starts the Nextjs development server, I am not able to see any code that are inside the ``` code block ```. Remember the code itself is not rendered for some reason.

Here is an screenshot of what's happening: Empty-code-prism

However if I build this with next build and try again, it shows up: after-build-prism

Steps to reproduce

I actually have a repo that clones this issue: Prism Code Issue Repo

The repo is for something else, however this branch is at the point where it fails. Simply do a yarn dev or npm run dev (after doing a npm install or yarn install), and simply open localhost:3000 and open the first post that should show the issue.

The things that are rendered are in the MDXComponents present inside the /components/MDXComponents file.

frostzt avatar Feb 05 '22 04:02 frostzt

it doesn't work with nextJS ?

sytpb avatar Aug 17 '22 09:08 sytpb

Well seems like this was some issue with rendering stuff, if I explicitly return it, it works.

frostzt avatar Aug 17 '22 10:08 frostzt