New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SyntaxHighlighter cannot be used as a JSX component #539
Comments
possibly a react 18 compatibility issue? |
added this to my "resolutions": {
"react": "18.2.0",
"react-dom": "18.2.0",
"@types/react": "18.2.21",
"@types/react-dom": "18.2.7"
}, |
H |
Who caress |
* upgrade dependencies * wip add contentlayer * wip update links and head tags * get next-themes working kinda * create-react-app for next 14 * idk, remove purgecss? * fix some invalid HTML * get projects kinda working * wip add blog to app * kinda get projects working * get blog working * get projects working * migrate contact page * migrate 404 * use built-in to transpile modules see https://nextjs.org/docs/app/api-reference/next-config-js/transpilePackages * add tailwind back * misc cleanup * fix tailwind content dirs * add blog post layout * rm more layouts * fix projects index * sort projects by date desc * tweak project card borders * pull out project item into its own file since I'll maybe use client at some point * add music page * kill last layout * oops add missing import * add more metadata * fix date vs. publishedAt * fix eslint errors * fixed some MDX components * use contentlayer for music * wip add test page * use remark-gfm@3 since v4 is still getting rolled out see remarkjs/remark-gfm#57 * update iframe * rm gray-matter * upgrade eslint * rm @types/react-syntax-highlighter because it was causing issues see react-syntax-highlighter/react-syntax-highlighter#539 * fix Google Analytics * fix some loudness wars typescript issues * first successful `yarn build` 🎉 * fix some stuff around slugs * i uhhhh alright I guess I'm escaping urls in my paths now * rm dummy next-14 dir * get cypress in a runnable state * kill react-spring / reach * daaaaang framer motion is cool * add social links to mobile nav * use new next ESLint plugin * clean up dependencies * run eslint * fix some blog metadata * fix more metadata * use FancyH1 for 404 * fix blog post title heading * add leading-8 to project and blog post pages * defer to tailwind typography over custom styles * fix tailwind content path * fix some more classnames and typography * fix project card image heights * minor tweaks to conform w/ Tailwind typography * change url * use [role="dialog"] instead of custom CSS selector * rm deprecated property * tell cypress it's ok to continue to NEXT_NOT_FOUND errors * fix music headings tests * rm double underline from links * make github percy quiet * add sharp * use custom h1 for project page * lint * rm dead code * fix og:image assertion * add favicon and apple-icon * rm unused permalink * fix project image link in head * add twitter to metadata * fix issue where I was only taking a screenshot of every other project * make dividing line in mobile nav dark theme aware * wait before taking screenshot of mobile nav * update browserslist * mv blog heading into page, not layout
Somehow it didn't work for me, and my temporary workaround was: import {Prism, SyntaxHighlighterProps} from 'react-syntax-highlighter';
const SyntaxHighlighter = Prism as typeof React.Component<SyntaxHighlighterProps>; |
I had the same issues. import {Prism, SyntaxHighlighterProps} from 'react-syntax-highlighter';
const SyntaxHighlighter = (Prism as any) as React.FC<SyntaxHighlighterProps>;
...tsx
return (
<SyntaxHighlighter
{...(props as any)}
children={String(children).replace(/\n$/, "")}
language={match[1]}
PreTag="div"
style={{ ...dark, overflowX: "scroll" }}
/>
); |
The issue is that your package manager is not resolving I manually deleted the resolution from my Edit: If you use yarn: |
I have tried removing the lock file and I'm still having this issue {
"react": "18.2.0",
"react-dom": "18.2.0",
"@types/react": "18.2.69",
"@types/react-dom": "18.2.7"
} |
@Inplex-sys It's possible another dependency it polluting the version resolution. You'd have to manually inspect the lock file to see what's going on. All
|
Describe the bug
Cannot use
Prism
as a JSX component in my remix esm projectcode:
The text was updated successfully, but these errors were encountered: