TailAdmin / tailadmin-free-tailwind-dashboard-template

Free and Open-source Tailwind CSS Dashboard Admin Template that comes with all essential dashboard UI components, pages and elements
https://tailadmin.com/
MIT License
1.19k stars 130 forks source link

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

Closed steinsag closed 2 months ago

steinsag commented 6 months ago

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.

Juhan-Ahamed commented 2 months ago

We have fixed the issue and updated the code