Daisy UI is not a Vite plugin and thus, should not be in the vite.config.js
. Rather, it is a Tailwind plugin and thus should be included with @plugin (when Daisy UI is compatible with v4).
Source: Wongjn's comment
TailwindCSS v4 (Daisy UI stable not supported yet; only Beta avaliable)
npm install -D tailwindcss @tailwindcss/vite daisyui@beta
Use the @plugin
directive to load a legacy JavaScript-based plugin. Add it to your own CSS file:
@import "tailwindcss";
@plugin "daisyui"; /* added Daisy UI TailwindCSS plugin */
In the meantime, use it with TailwindCSS v3 by following the instructions below:
TailwindCSS v3 (supported)
npm install -D tailwindcss@3 daisyui@latest
tailwind.config.js
module.exports = {
content: [
'./src/**/*.{vue,js,ts}',
],
plugins: [
require('daisyui'), // added Daisy UI TailwindCSS plugin
],
};
or in an ES6 compatible version:
import daisyui from 'daisyui';
export default {
content: [
'./src/**/*.{vue,js,ts}',
],
plugins: [
daisyui, // added Daisy UI TailwindCSS plugin
],
};
vite.config.js
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import tailwindcss from 'tailwindcss' // use TailwindCSS v3 installation guide
// https://vite.dev/config/
export default defineConfig({
plugins: [
react(),
tailwindcss(),
// You don't need to add Daisy UI here because it is not a Vite plugin.
],
})