-
-
Notifications
You must be signed in to change notification settings - Fork 272
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
PrismLight using results in regular [object Object] output (but only in production) #513
Comments
We see this same issue intermittently with |
I wonder if this is due to using refractor 3.x vs. 4.x as also seen in wooorm/refractor#59. |
For others with this issue, using @fenkx's fork fixes the issue, the easiest way to switch is just change this line in your package.json: "react-syntax-highlighter": "npm:@fengkx/react-syntax-highlighter@15.6.1" |
I have the same issue but I guess this package is not maintained anymore 😕 |
I had the same problem, but the above scenario didn't solve my problem. |
+1 |
This happens to me as well, what can I do about this? |
I'm experiencing this issue as well. I was able to work around it by adding this to my import { PrismAsyncLight as SyntaxHighlighter } from 'react-syntax-highlighter'
ReactDOM.createRoot(document.createElement('div')).render(
<SyntaxHighlighter language="" children={''} />
) |
* chore(vite): use vite * fix(vite): alias lib directory * chore(vite): set type: module * chore: update vite and MUI * fix(vite): make MUI components load * fix: use node path resolution * chore(vite): add svg support * fix(vite): polyfill global * fix(vite): use import.meta * fix(vite): use correct svg module resolution * chore(vite): migrate to vitest * fix(vite): remove PUBLIC_URL * fix(tests): mock audio service * chore(deps): upgrade to react test library 14 * refactor(tests): simplify room test setup * refactor(tests): make Date.now() mockable * refactor(vite): remove bootstrap shim * chore(deps): drop react-scripts * chore(deps): remove source-map-explorer Source maps do not currently work with MUI and Vite: vitejs/vite#15012 Because of this, source map utilities are currently removed. * refactor(vite): use TypeScript for Vite config * chore(actions): update actions config for new paths * fix(service-worker): use VITE_HOMEPAGE for service worker resolution * fix(vercel): use quotes for build command * fix(vite): use import.meta.env.MODE * fix(service-worker): use correct definition for publicUrl * feat(vite): use vite-plugin-pwa * fix(pwa): make update prompt work * fix(types): use vite/client types * docs(readme): update building instructions * refactor(vite): simplify theme loading workaround * refactor(vite): use manifest object * docs(readme): update tool references * chore(deps): run `npm audit fix` * fix(vite): make syntax highlighter work consistently See: react-syntax-highlighter/react-syntax-highlighter#513 * fix(pwa): remove manifest.json references * refactor(deps): remove jest references * refactor(types): remove react-scripts reference * chore(deps): use TypeScript 5 * refactor(tests): improve persisted storage mocking
Unfortunately this doesn't work for me. This issue is not present when I use It's only present when I use SSR and Any idea how I could workaround this issue when using partial hydration? Update: I switched to |
Describe the bug
I'm using
import { PrismLight as SyntaxHighlighter } from 'react-syntax-highlighter';
which results in regular[object Object] [object Object] ...
output (around 7 of 10 refreshs of my webpage) for my code blocks (but only in production). Notice:import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
has the same problem. Every 4th to 5th refresh, it's working correctly, otherwise it's rendering[object Object] ...
To Reproduce
Steps to reproduce the behavior: This is my implementation, notice that the
processedCode
output of theprocess
function is always correct (also in production). But even without thisprocess
function, the problem persists.It's working when I do a bad workaround to force reloading of the component:
Expected behavior
Output my code string (it's a simple code string of a React Component) instead of
[object Object]
in some cases. Oddly enough in my dev environment it's always working fine, only in production is the rendering issue with[object Object]
Screenshots
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: