-
Notifications
You must be signed in to change notification settings - Fork 106
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
Error building next js app #135
Comments
Same issue |
My workaround was to create a wrapper component at the layout level. export default function Wrapper({ children }: {children?: ReactNode}) {
const [ready, setReady] = useState(false);
useEffect(() => {
setReady(true);
}, []);
if (!ready) return null;
return <main>{children}</main>;
} Just put the wheel component anywhere inside the wrapper, and it should work. |
did not worked for me sadly on nextjs |
This one worked for me |
Any update on this issue? |
worked for me: Modify your import statement for the Wheel component to use Next.js is dynamic imports with ssr set to false. This tells Next.js to only render the component on the client side. Old: Replace:
|
Problem
I get the following error message after running
npm run build
:ReferenceError: window is not defined
Description
I'm importing from a client component (
"use client"
) the wheel component. Unfortunately, the build fails. I verified the problem was the wheel component because after removing it, the build was completed as expected.I tried the wheel component using the basic setup in the
README
.The wheel component works when I run the
npm run dev
command. The problem is observed only when trying to build the app.The text was updated successfully, but these errors were encountered: