Skip to content

bug: @plugin "daisyui" resolves to daisyui.css instead of index.js on Vite 8 with Node 25 #4503

Closed

Description

@emmontenegro

Reproduction URL (Required)

https://github.com/saadeghi/daisyui/issues

What version of daisyUI are you using?

v5.5.19

Which browsers are you seeing the problem on?

All browsers

Describe your issue

I'm encountering a build failure when using daisyUI with Tailwind CSS 4 and Vite. It appears that @plugin "daisyui" resolves to daisyui.css instead of index.js, causing the build to fail.

Environment:

  • tailwindcss: 4.2.3
  • @tailwindcss/vite: 4.2.3
  • daisyui: 5.5.19
  • vite: 8.0.9
  • node: 25.2.21
  • macOS (local Docker-based PHP project)

Setup:

vite.config.js

import { defineConfig } from 'vite'
import tailwindcss from '@tailwindcss/vite'

export default defineConfig({
    plugins: [
        tailwindcss(),
    ],
    build: {
        outDir: 'dist',
        emptyOutDir: true,
        rollupOptions: {
            input: {
                app: 'assets/css/app.css',
            },
            output: {
                assetFileNames: 'assets/[name].css',
            },
        },
    },
})

assets/css/app.css

@import "tailwindcss";
@plugin "daisyui";

Error:

TypeError: Unknown file extension ".css" for .../node_modules/daisyui/daisyui.css
Observed Behavior:

It seems that @plugin "daisyui" resolves to:

node_modules/daisyui/daisyui.css

instead of:

node_modules/daisyui/index.js

In daisyUI's package.json, I noticed:

- "main": "./index.js"
- "module": "./index.js"
- "browser": "./daisyui.css"

This suggests that the browser field may be selected during resolution, even though a JS plugin entry is required.

Workaround:

Using the direct JS path works correctly:

@import "tailwindcss";
@plugin "../node_modules/daisyui/index.js";

After forcing the plugin to load from index.js, the build completes successfully.

Additional Notes:

  • This may be related to Node 25 behavior, since Node 25 is newer than commonly used LTS versions.
  • All dependencies were freshly installed and caches cleared.
  • No direct @import "daisyui.css" statements exist in the project.

Question:

Is this expected behavior with the current package exports setup, or should @plugin "daisyui" always resolve to index.js regardless of the browser field?

Activity

  1. github-actions commented on Apr 21, 2026

    @github-actions

    Thank you @emmontenegro for reporting issues. It helps daisyUI a lot 💚
    I'll be working on issues one by one. I will help with this one as soon as a I find a solution.
    In the meantime providing more details and reproduction links would be helpful.

  2. pdanpdan commented on Apr 21, 2026

    @pdanpdan
    Contributor

    Are you using tailwind vite 4.2.3?
    If you are then it has nothing to do with node version
    tailwindlabs/tailwindcss#19946

  3. emmontenegro commented on Apr 21, 2026

    @emmontenegro
    Author

    Thanks for pointing that out.

    Just checked, and seems similar. The pckage-name resolution is the part failing I guess.

  4. saadeghi commented on Apr 21, 2026

    @saadeghi
    Owner

    Can you confirm that the issue is fixed in Tailwind CSS 4.2.4?

  5. cernyjakub commented on Apr 22, 2026

    @cernyjakub

    I am still getting this error with Tailwind 4.2.4

  6. saadeghi commented on Apr 22, 2026

    @saadeghi
    Owner

    I would suggest staying on the previous version of Tailwind CSS until this gets fixed. 4.2.2 must be fine. Apparently the issue started with Tailwind CSS 4.2.3 yesterday.

  7. cernyjakub commented on Apr 22, 2026

    @cernyjakub

    Yes, 4.2.2 works OK.

  8. miguelmagueijo commented on Apr 24, 2026

    @miguelmagueijo

    4.2.2 doesn't work, see #4510

  9. saadeghi commented on Apr 24, 2026

    @saadeghi
    Owner

    @miguelmagueijo Try #4505 (comment)

    Also, this is expected to be fixed in the next Tailwind CSS release. The PR is merged.

  10. pdanpdan commented on Apr 24, 2026

    @pdanpdan
    Contributor

    4.2.2 doesn't work, see #4510

    Yes, it works. In your package.json you have "@tailwindcss/vite": "^4.2.2" that means most recent 4 version, and that is 4.2.4

  11. manishambre5 commented on Apr 24, 2026

    @manishambre5

    I am using "@tailwindcss/vite": "^4.2.4" and switching to @import "daisyui/daisyui.css"; from @plugin "daisyui"; works.

  12. bturski commented on Apr 25, 2026

    @bturski

    @manishambre5 - I needed to change @plugin to reference index.js:

    @plugin 'daisyui' {
      themes: all;
    }
    

    to

    @plugin 'daisyui/index.js' {
      themes: all;
    }
    
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