0

I am switching from next.js Pages Router to the new App Router.

Trying to figure out how to include flowbite script files in layouts - don't really need them at root.

Previously I included them in the _document.js like so:

    <Html lang="en">
      <Head />
      <body>
        <Main />
        <NextScript />
        <Script src="/flowbite.min.js" strategy="afterInteractive" />
      </body>
    </Html>

Since the App router no longer seems to have a _document.js now I am unsure where to move the <Script> tag to.

I have tried adding it to the RootLayout and within a /dashboard/layout.js where I added my <ThemeProvider> which seems to work ok, but no matter what, none of the flowbite.js functions seem to work any more. Theme provider buttons work ok, but none of the flowbite menus, navigation dropdowns etc

I can always manually replace the script stuff, but I'd rather just get to a working state first, so what am I missing?

TIA.

codenext
  • 1
  • 2
  • Have you tried Next.js getting started guide? https://flowbite.com/docs/getting-started/next-js/ – Igor Danchenko May 24 '23 at 13:42
  • yeah, i used the docs to set up flowbite with the Pages router which has worked fine for the last few months, but when I move the script tag into the App router, the script never runs. – codenext May 24 '23 at 15:21

0 Answers0