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

Rails 7: Error: Cannot find module 'flowbite/plugin' #687

Open
didlix opened this issue Oct 17, 2023 · 4 comments
Open

Rails 7: Error: Cannot find module 'flowbite/plugin' #687

didlix opened this issue Oct 17, 2023 · 4 comments

Comments

@didlix
Copy link

didlix commented Oct 17, 2023

Describe the bug
I was running Rails 7.0.4 and an outdated version of tailwindcss-rails, followed the instructions from the documentation and got the error described in the title

I decided to update the version of tailwindcss-rails to try and resolve it that way, at which point I got a new error which you can find described here..

(I eventually uodated everything so am now on Rails 7.0.8)

It seems there is an issue resolving the plugin and I am not sure what to do to try and resolve it. Any suggestions would be appreciated.

Expected behavior
The plugin would load and I would be able to boot my rails 7 app and use flowbite.

Desktop (please complete the following information):

  • OS: Intel MacOS 14.0

Additional context
Add any other context about the problem here.

rails/tailwindcss-rails#269

@spaquet
Copy link

spaquet commented Oct 26, 2023

defaultTheme is not found.

@antonioeloi
Copy link

If you are using importmap, the default way of handling JavaScript on Rails 7, don't forget to:

  1. Add the following line inside your importmap.rb file:
    pin "flowbite", to: "https://cdn.jsdelivr.net/npm/[email protected]/dist/flowbite.turbo.min.js"

  2. Then you need to import flowbite inside your application.js file:
    import 'flowbite';

Reference: https://flowbite.com/docs/getting-started/rails/

@spaquet
Copy link

spaquet commented Aug 24, 2024

@antonioeloi this is assuming that the project is using importmap... But for esbuild?

@antonioeloi
Copy link

@spaquet just beneath what I pasted as reference you can find the following:

ESBuild

If you use ESBuild to Bundle your JavaScript on Rails, you will need to import a version of Flowbite which supports the turbo:load event listeners instead of load. To do this add the line below to your application.js file:

import "flowbite/dist/flowbite.turbo.js";

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

3 participants