I want to use only flowbite
package with tailwind in my nextjs application. I configure everything correctly. But adding flowbite.min.js
script throws me error –
GET http://localhost:3000/node_modules/flowbite/dist/flowbite.min.js net::ERR_ABORTED 404 (Not Found)
I add the script in my _app.js
file as nextjs documentation suggested. Here is my _app.js
file
import Script from 'next/script'
import '~/styles/globals.css'
export default function App({Component, pageProps}) {
return (
<>
<Script src='../node_modules/flowbite/dist/flowbite.min.js' />
<Component {...pageProps} />
</>
)
}
In flowbite documentation at number 4 they suggest to add this script end of the body tag
<script src="../path/to/flowbite/dist/flowbite.min.js"></script>
Since I’m using nextjs, I add this script in my _app.js
file. I try with cdn and it works. Probably I’m adding path wrongly. What should be the path for flowbite.min.js
script?
In nextjs I don’t want to use flowbite-react
.
2
Answers
I suggest using flowbites cdn, as sometimes your node_modules isn’t in the public folder.
CDN url: https://cdnjs.cloudflare.com/ajax/libs/flowbite/1.6.4/flowbite.min.js
As stated in the nextjs specific setup guide in flowbite docs you should directly use flowbite components from the
flowbite-react
package.flowbite-react
So you can use Flowbite components like this: