-
Notifications
You must be signed in to change notification settings - Fork 12
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
Got "window is not defined" when using with next js #54
Comments
are you importing with dynamic feature of next with ssr disabled ? or just with an basic import ? can you show us how you imported ? |
Just to those who see this before trying the project 🤷 - it is working fine with basic import in NextJS component. Btw I just switched to this project blindly trying to deal with no SSR support in dev-juju/EditorJS-React-Renderer and it just worked. |
@kepi What version of nextjs and react are you using? I"m having the same 'window' issue with nextjs |
NextJS 12.2.4, react 17.0.2. And my // Generated by ReScript, PLEASE EDIT WITH CARE
import * as React from "react";
import * as Caml_option from "rescript/lib/es6/caml_option.js";
import EditorjsBlocksReactRenderer from "editorjs-blocks-react-renderer";
var Blocks = {};
function Output(Props) {
var data = Props.data;
if (data !== undefined) {
return React.createElement("div", {
className: "prose"
}, React.createElement(EditorjsBlocksReactRenderer, {
data: Caml_option.valFromOption(data)
}));
} else {
return React.createElement("div", undefined, "No data");
}it@git.logbookie.eu:dho/expanzo-web.git
}
var make = Output;
export {
Blocks ,
make ,
}
/* react Not a pure module */ To avoid any unwanted confusion: I'm just moving to Next.js from Gatsby, and I'm in it for maybe three evenings, so it is possible that my use case is different. Take it as noobs input to discussion :) But, using completely same code and dependencies with EditorJS-React-Renderer I got |
I'm facing the same issue nextjs 13 app dir dynamic import and basic import both same problem Anyone know how to fix this? |
We are facing this issue in Nextjs 13 first after enabling edge functions with |
Thanks for the good info. Add this to next.config.js
Problem solved! |
Actually i found a very good source for nextjs/app dir implementation for editorjs. |
Purpose
Description
Hi, I'am using editor js renderer with react project then its working well. However, after I convert project to next js then it crashed with error "window is not defined". How can I fix it. Thanks.
The text was updated successfully, but these errors were encountered: