-
Notifications
You must be signed in to change notification settings - Fork 160
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
Can't create a production build with package imported - Error occurred prerendering page; ReferenceError: window is not defined #112
Comments
Same here. Were you able to find a solution? |
getting the same issue too |
@JayWebtech @RamazaniMwemedi this worked for me,
|
Started getting this error immediately I migrate to Nextjs 15, React 19 (Server component) |
An email from the developer team on how I should go around it. Here is the link https://paystack.com/docs/api/transaction/#initialize |
Hmmm.... That may be straightforward approach. I should have adopted using the API directly rather than SDK. But currently I fixed the window error by converting the whole page to client with I first of all mark the component with 'use client' then in on doing that, the error is gone... |
@stephengade 's comment did the trick My implementation looks like this, using the - import { PaystackButton } from "react-paystack";
+ import dynamic from 'next/dynamic';
+ const PaystackButton = dynamic(() => import("react-paystack").then((c) => c.PaystackButton), {
+ ssr: false,
+ });
|
Whenever I try to make a production build with this component imported, it keep throwing an error as shown below
I have troubleshooted and I have noticed that the error comes from here
I have tried to import it with Dynamics but still no changes,
The text was updated successfully, but these errors were encountered: