Skip to content

bug: @plugin "flyonui" breaks with @tailwindcss/vite 4.2.4 — resolves to flyonui.css instead of index.js #144

Description

@areski

What version of FlyonUI are you using?

2.4.1

Describe your issue

After upgrading @tailwindcss/vite from 4.2.2 to 4.2.4, the Vite dev server throws the following error:

Unknown file extension ".css" for .../node_modules/flyonui/flyonui.css
Plugin: @tailwindcss/vite:generate:serve
File: src/css/main.css

Root cause:

@tailwindcss/vite 4.2.4 changed how it resolves @plugin directives — it now uses Vite's browser-aware resolver instead of plain Node.js resolution.

flyonui's package.json declares both a main and a browser field:

"main": "./index.js",
"browser": "./flyonui.css"

Vite's resolver honors the browser field, so @plugin "flyonui" resolves to flyonui.css instead of index.js. Node.js then fails trying to dynamically import() a .css file as an ES module.

Workaround:

Explicitly reference the JS entry point in the @plugin directive:

@plugin "flyonui/index.js" {
themes: all;
}

Expected behavior:

@plugin "flyonui" should resolve to the JS plugin (index.js), not the CSS bundle (flyonui.css).

Suggested fix:

The cleanest fix on flyonui's side would be to add a proper exports map in package.json with a tailwind-plugin or default condition pointing to index.js, so that @tailwindcss/vite's resolver always gets the JS entry regardless of the browser field:

"exports": {
".": {
"browser": "./flyonui.css",
"default": "./index.js"
}
}

Environment:

  • flyonui: 2.4.1
  • @tailwindcss/vite: 4.2.4
  • tailwindcss: 4.2.4
  • vite: 7.3.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions