flowbite-react icon indicating copy to clipboard operation
flowbite-react copied to clipboard

Bug Report: EMFILE error (too many open files) in development mode with flowbite-react/plugin/vite

Open marco-amendola opened this issue 7 months ago • 8 comments

🔍 Bug Description The flowbite-react/plugin/vite plugin causes an EMFILE: too many open files error when running Vite in development mode, but works fine in production builds.

Environment OS: macOS (MacBook Air) Node.js: v22.17.1 Package Manager: npm Vite: Latest version flowbite-react: Latest version with new auto-generated class-list.json feature

Steps to Reproduce Configure Vite with the flowbite-react plugin: plugins: [ Run development server: Error occurs immediately ❌Error Output ✅ Current Workaround

The only working solution is to conditionally load the plugin only in production: This allows: ✅ Development server to run without errors ✅ Production builds to include flowbite-react functionality ❌ Loss of flowbite-react features during development

Attempted Solutions That Don't Work Increasing system file limits: Vite watch configuration: Disabling plugin features:

Analysis The issue seems related to the new auto-generation feature of class-list.json in the .flowbite-react directory and maybe other files observed The plugin appears to:

Monitor too many files simultaneously Create recursive file watchers Possibly watch the class-list.json file it's generating, creating an infinite loop Conflict with Vite's native file watching system

Expected Behavior The plugin should work in both development and production modes File watching should be optimized to avoid hitting system limits The plugin should not interfere with Vite's native HMR system

Possible Fixes Implement debounced file watching Limit the number of files being watched simultaneously Exclude auto-generated files from the watcher Add configuration options to disable intensive watching in development Use a more efficient file watching strategy

Project Context Laravel + Vite + React application Large codebase with multiple plugins Standard macOS development environment

marco-amendola avatar Jul 24 '25 18:07 marco-amendola

Can u please specify exactly on what flowbite-react version this is reproducible? There has been some file watcher improvements in [email protected] release.

SutuSebastian avatar Jul 31 '25 07:07 SutuSebastian

"flowbite-react": "^0.12.2",

marco-amendola avatar Jul 31 '25 10:07 marco-amendola

I can't seem to reproduce this, even with the same stack Laravel + Vite + React 🤔

SutuSebastian avatar Jul 31 '25 10:07 SutuSebastian

Is it possible beacause my project has many files? I’m sure that is a problem caused by flowbite plugin, beacause when i remove it from “plugins” of vite the dev mode works well

How i can help you to reproduce the error?

marco-amendola avatar Jul 31 '25 11:07 marco-amendola

It's definitely from the plugin, I just want to be able to reproduce it so I can test, debug and improve it.

SutuSebastian avatar Jul 31 '25 11:07 SutuSebastian

It's definitely from the plugin, I just want to be able to reproduce it so I can test, debug and improve it.

maybe i can give you the project where this happens?

marco-amendola avatar Aug 02 '25 17:08 marco-amendola

If it's not confidential, sure why not

SutuSebastian avatar Aug 02 '25 18:08 SutuSebastian

Does it still happen with the latest release?

SutuSebastian avatar Dec 15 '25 10:12 SutuSebastian