Skip to content
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

next.js: Not building when Loader component removed #8

Open
steinsag opened this issue Feb 23, 2024 · 0 comments
Open

next.js: Not building when Loader component removed #8

steinsag opened this issue Feb 23, 2024 · 0 comments

Comments

@steinsag
Copy link

On root page, there is a loading spinner included, which is removed automatically after 1s. I tried removing this spinner completely:

src/app/layout.tsx

...

export default function RootLayout({
  children,
}: Readonly<{
  children: React.ReactNode;
}>) {
  return (
    <html lang="en">
      <body>
        <div className="dark:bg-boxdark-2 dark:text-bodydark">{children}</div>
      </body>
    </html>
  );
}

But this causes a strange error when running next build:

   Generating static pages (0/18)  [    ]ReferenceError: window is not defined
...
Error occurred prerendering page "/chart". Read more: https://nextjs.org/docs/messages/prerender-error

ReferenceError: window is not defined
...
Error occurred prerendering page "/".

How can I fix that? I don't want to artifically delay page rendering and setting the loader timeout to a few milliseconds causes an ugly flickering effect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant