Errors rendering Editor in Next.js
See original GitHub issueBug Description
I was trying to create Story Editor in Next.js however there were several errors that appear one after the other ( Most of them are due to Next.js SSR )
( Gets fixed by removing CSS import ) Reference: https://nextjs.org/docs/messages/css-npm
( Gets fixed by using globalThis
)
( Gets fixed by removing "type": "module"
from package.json
)
Expected Behaviour
Editor and dashboard should work without any issues in NextJs.
Steps to Reproduce
Step - 1: npx create-next-app@latest
Step - 2: Use snippet from getting-started to use the editor
Screenshots
Additional Context
- Plugin Version:
- WordPress Version:
- Operating System:
- Browser:
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:8
Top Results From Across the Web
Advanced Features: Error Handling - Next.js
Render a fallback UI after an error is thrown; Provide a way to reset the Application's state; Log error information. You can create...
Read more >Testing and error handling patterns in Next.js - LogRocket Blog
Check out these different ways to run tests and handle errors in Next.js apps using Cypress, a JavaScript-based testing framework.
Read more >Troubleshooting JSS Next.js apps - Sitecore Documentation
If your app renders and builds correctly in your local development environment, but fails to render when deployed to Vercel, a possible reason ......
Read more >not working in next js correctly · Issue #31 · Jungwoo-An/react ...
hi I imported this in Nextjs,dynamic because error for window but most plugin don't work. ... Check the render method of `Editor`.
Read more >How to solve "window is not defined" errors in React and Next.js
Next.js is a React framework with pre-rendering abilities. This means that for every page, Next.js... Tagged with javascript, nextjs, errors ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just adding a note here for reference.
We can ignore
document
/window
/self
or similar things if:useEffect
/useLayoutEffect
hooks because they are not called during SSR.try/catch
Ah right, yeah that makes sense. Because we import CSS files in
wp-story-editor
andwp-dashboard
that wouldn’t work. An ESLint rule is a great idea 👍