Next.js Discord

Discord Forum

beforeIntgeractive script isn't running sooner

Unanswered
Australian Freshwater Crocodile posted this in #help-forum
Open in Discord
Avatar
Australian Freshwater CrocodileOP
export default function RootLayout({
    children
}: {
    children: React.ReactNode;
}) {
    return (
        <html lang="en">
            <head>
                <Script src="/theme.js" strategy="beforeInteractive" async />
            </head>
            <body
                className={
                    firacode.className + ' bg-white transition-all dark:bg-zinc-900'
                }
            >
                <Toaster position="top-center" />
                {children}
                <SpeedInsights />
                <Analytics />
            </body>
        </html>
    );
}


the script is a simple console.log() and it isn't being run till the entire thing is loaded for some reason, why and how can i fix it

0 Replies