Skip to content

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

@marco-amendola

Description

@marco-amendola

🔍 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

Metadata

Metadata

Assignees

Labels

🐛 bugSomething isn't working

Type

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions