Skip to content

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

Open

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

Activity

  1. github-actions commented on May 4, 2026

    @github-actions
    Hi @areski

    Thank you for your support in helping us improve FlyonUI!

    We’ve received your submission and will respond within few business days. Our team handles issues one at a time, and we’ll be reviewing yours as soon as possible.

    In the meantime, any additional details or a reproducible example would be greatly appreciated and will help us resolve the issue more efficiently.

    Thank you for your patience and understanding!

  2. yagnikvamja commented on May 5, 2026

    @yagnikvamja
    Member

    Hello @areski ,

    This issue appears to be related to recent changes in Tailwind CSS (v4+) and its Vite integration, which have introduced breaking changes in how CSS files and plugins are handled.

    For more detailed context, you can refer to the official discussion here: tailwindlabs/tailwindcss#19950

    As a temporary workaround, the Tailwind team has suggested using an insiders version of the Vite plugin. You can install it with:

    npm install -D @tailwindcss/vite@0.0.0-insiders.f3fdda2
    

    This version includes fixes that address the current compatibility issues.

    ~Best regards,

  3. areski commented on May 5, 2026

    @areski
    Author

    For me it was simply fixed by changing the directive:

    @plugin "flyonui"{
        themes: all;
    }
    

    To:

    @plugin "flyonui/index.js" {
        themes: all;
    }
    
  4. yagnikvamja commented on May 5, 2026

    @yagnikvamja
    Member

    Hello,

    Thank you for sharing this solution. Explicitly referencing the JavaScript entry point using:

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

    is a valid and effective workaround(As you have suggested).

    As the root cause appears to stem from recent changes on the Tailwind CSS side, this approach can be used safely until an official fix is released. In the meantime, either this method or the insiders build suggested earlier are both reasonable options depending on your setup.

    Appreciate you taking the time to highlight this.

    ~Best regards,

  5. Gabskit commented on Jun 4, 2026

    @Gabskit

    I got same problem

    I was making my app in vue 3 and flyonui and i got the same bug

    Console log:
    ✗ Build failed in 22.27s
    error during build:
    Build failed with 1 error:[plugin vite:css] /home/Pretexto2/node_modules/.pnpm/flyonui@2.4.1/node_modules/flyonui/flyonui.css:1:87368
    SyntaxError: [lightningcss] Unexpected token CurlyBracketBlock
    at aggregateBindingErrorsIntoJsError (file:///home/Pretexto2/node_modules/.pnpm/rolldown@1.0.2/node_modules/rolldown/dist/shared/error-B8po7KiL.mjs:48:18)
    at unwrapBindingResult (file:///home/Pretexto2/node_modules/.pnpm/rolldown@1.0.2/node_modules/rolldown/dist/shared/error-B8po7KiL.mjs:18:128)
    at #build (file:///home/Pretexto2/node_modules/.pnpm/rolldown@1.0.2/node_modules/rolldown/dist/shared/rolldown-build-9MccaWPU.mjs:3236:34)
    at async buildEnvironment (file:///home/Pretexto2/node_modules/.pnpm/vite@8.0.14_@types+node@24.12.4_jiti@2.7.0_less@4.6.4_yaml@2.9.0/node_modules/vite/dist/node/chunks/node.js:33137:64)
    at async Object.build (file:///home/Pretexto2/node_modules/.pnpm/vite@8.0.14_@types+node@24.12.4_jiti@2.7.0_less@4.6.4_yaml@2.9.0/node_modules/vite/dist/node/chunks/node.js:33559:19)
    at async Object.buildApp (file:///home/Pretexto2/node_modules/.pnpm/vite@8.0.14_@types+node@24.12.4_jiti@2.7.0_less@4.6.4_yaml@2.9.0/node_modules/vite/dist/node/chunks/node.js:33556:153)
    at async CAC. (file:///home/Pretexto2/node_modules/.pnpm/vite@8.0.14_@types+node@24.12.4_jiti@2.7.0_less@4.6.4_yaml@2.9.0/node_modules/vite/dist/node/cli.js:777:3) {
    errors: [Getter/Setter]
    }
     ELIFECYCLE  Command failed with exit code 1.
    ERROR: "build-only" exited with 1.
     ELIFECYCLE  Command failed with exit code 1.

    I use pnpm 9
    Vue 3.5.32
    Tw 4.3.0
    Vite 8.0.8
    Ts 6
    Flyon 2.4.1
    I applied the same solution of "flyon/index.js" and insider version and it didn't work for me

  6. yagnikvamja commented on Jun 9, 2026

    @yagnikvamja
    Member

    I got same problem

    I was making my app in vue 3 and flyonui and i got the same bug

    Console log:
    ✗ Build failed in 22.27s
    error during build:
    Build failed with 1 error:[plugin vite:css] /home/Pretexto2/node_modules/.pnpm/flyonui@2.4.1/node_modules/flyonui/flyonui.css:1:87368
    SyntaxError: [lightningcss] Unexpected token CurlyBracketBlock
    at aggregateBindingErrorsIntoJsError (file:///home/Pretexto2/node_modules/.pnpm/rolldown@1.0.2/node_modules/rolldown/dist/shared/error-B8po7KiL.mjs:48:18)
    at unwrapBindingResult (file:///home/Pretexto2/node_modules/.pnpm/rolldown@1.0.2/node_modules/rolldown/dist/shared/error-B8po7KiL.mjs:18:128)
    at #build (file:///home/Pretexto2/node_modules/.pnpm/rolldown@1.0.2/node_modules/rolldown/dist/shared/rolldown-build-9MccaWPU.mjs:3236:34)
    at async buildEnvironment (file:///home/Pretexto2/node_modules/.pnpm/vite@8.0.14_@types+node@24.12.4_jiti@2.7.0_less@4.6.4_yaml@2.9.0/node_modules/vite/dist/node/chunks/node.js:33137:64)
    at async Object.build (file:///home/Pretexto2/node_modules/.pnpm/vite@8.0.14_@types+node@24.12.4_jiti@2.7.0_less@4.6.4_yaml@2.9.0/node_modules/vite/dist/node/chunks/node.js:33559:19)
    at async Object.buildApp (file:///home/Pretexto2/node_modules/.pnpm/vite@8.0.14_@types+node@24.12.4_jiti@2.7.0_less@4.6.4_yaml@2.9.0/node_modules/vite/dist/node/chunks/node.js:33556:153)
    at async CAC. (file:///home/Pretexto2/node_modules/.pnpm/vite@8.0.14_@types+node@24.12.4_jiti@2.7.0_less@4.6.4_yaml@2.9.0/node_modules/vite/dist/node/cli.js:777:3) {
    errors: [Getter/Setter]
    }
     ELIFECYCLE  Command failed with exit code 1.
    ERROR: "build-only" exited with 1.
     ELIFECYCLE  Command failed with exit code 1.

    I use pnpm 9 Vue 3.5.32 Tw 4.3.0 Vite 8.0.8 Ts 6 Flyon 2.4.1 I applied the same solution of "flyon/index.js" and insider version and it didn't work for me

    Hello @Gabskit ,

    This appears to be a different issue from the one reported previously. The earlier issue was related to Tailwind CSS Vite, which has already been resolved.

    Based on the error logs you shared, we are currently unable to determine the root cause of the problem. Could you please provide a minimal reproduction example or the steps required to reproduce the issue?

    ~Best regards,

  7. Gabskit commented on Jun 10, 2026

    @Gabskit

    I got same problem

    I was making my app in vue 3 and flyonui and i got the same bug

    Console log:
    ✗ Build failed in 22.27s
    error during build:
    Build failed with 1 error:[plugin vite:css] /home/Pretexto2/node_modules/.pnpm/flyonui@2.4.1/node_modules/flyonui/flyonui.css:1:87368
    SyntaxError: [lightningcss] Unexpected token CurlyBracketBlock
    at aggregateBindingErrorsIntoJsError (file:///home/Pretexto2/node_modules/.pnpm/rolldown@1.0.2/node_modules/rolldown/dist/shared/error-B8po7KiL.mjs:48:18)
    at unwrapBindingResult (file:///home/Pretexto2/node_modules/.pnpm/rolldown@1.0.2/node_modules/rolldown/dist/shared/error-B8po7KiL.mjs:18:128)
    at #build (file:///home/Pretexto2/node_modules/.pnpm/rolldown@1.0.2/node_modules/rolldown/dist/shared/rolldown-build-9MccaWPU.mjs:3236:34)
    at async buildEnvironment (file:///home/Pretexto2/node_modules/.pnpm/vite@8.0.14_@types+node@24.12.4_jiti@2.7.0_less@4.6.4_yaml@2.9.0/node_modules/vite/dist/node/chunks/node.js:33137:64)
    at async Object.build (file:///home/Pretexto2/node_modules/.pnpm/vite@8.0.14_@types+node@24.12.4_jiti@2.7.0_less@4.6.4_yaml@2.9.0/node_modules/vite/dist/node/chunks/node.js:33559:19)
    at async Object.buildApp (file:///home/Pretexto2/node_modules/.pnpm/vite@8.0.14_@types+node@24.12.4_jiti@2.7.0_less@4.6.4_yaml@2.9.0/node_modules/vite/dist/node/chunks/node.js:33556:153)
    at async CAC. (file:///home/Pretexto2/node_modules/.pnpm/vite@8.0.14_@types+node@24.12.4_jiti@2.7.0_less@4.6.4_yaml@2.9.0/node_modules/vite/dist/node/cli.js:777:3) {
    errors: [Getter/Setter]
    }
     ELIFECYCLE  Command failed with exit code 1.
    ERROR: "build-only" exited with 1.
     ELIFECYCLE  Command failed with exit code 1.

    I use pnpm 9 Vue 3.5.32 Tw 4.3.0 Vite 8.0.8 Ts 6 Flyon 2.4.1 I applied the same solution of "flyon/index.js" and insider version and it didn't work for me

    Hello @Gabskit ,

    This appears to be a different issue from the one reported previously. The earlier issue was related to Tailwind CSS Vite, which has already been resolved.

    Based on the error logs you shared, we are currently unable to determine the root cause of the problem. Could you please provide a minimal reproduction example or the steps required to reproduce the issue?

    ~Best regards,

    Hello, here how i got that bug

    1. Create vue project and install flyonui and tailwind 4
    2. Use of flyonui lib
    3. Build with pnpm build
      That's how i got the bug, I don't think if another lib affects i checked the file that appears on the log and it actually has that sintaxis error for some reason.
      I hope this is helpful.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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