diff --git a/src/tailwind.ts b/src/tailwind.ts index 2fc1594747..412f05bc4f 100644 --- a/src/tailwind.ts +++ b/src/tailwind.ts @@ -30,21 +30,26 @@ export default function installTailwind( // 2. add config template const configTemplate = addTemplate({ - filename: 'nuxtui-tailwind.config.cjs', + filename: 'nuxtui-tailwind.config.mjs', write: true, getContents: ({ nuxt }) => ` - const { defaultExtractor: createDefaultExtractor } = require('tailwindcss/lib/lib/defaultExtractor.js') - const { customSafelistExtractor, generateSafelist } = require(${JSON.stringify(resolve(runtimeDir, 'utils', 'colors'))}) + import { defaultExtractor as createDefaultExtractor } from "tailwindcss/lib/lib/defaultExtractor.js"; + import { customSafelistExtractor, generateSafelist } from ${JSON.stringify(resolve(runtimeDir, 'utils', 'colors'))}; + import formsPlugin from "@tailwindcss/forms"; + import aspectRatio from "@tailwindcss/aspect-ratio"; + import typography from "@tailwindcss/typography"; + import containerQueries from "@tailwindcss/container-queries"; + import headlessUi from "@headlessui/tailwindcss"; - const defaultExtractor = createDefaultExtractor({ tailwindConfig: { separator: ':' } }) + const defaultExtractor = createDefaultExtractor({ tailwindConfig: { separator: ':' } }); - module.exports = { + export default { plugins: [ - require('@tailwindcss/forms')({ strategy: 'class' }), - require('@tailwindcss/aspect-ratio'), - require('@tailwindcss/typography'), - require('@tailwindcss/container-queries'), - require('@headlessui/tailwindcss') + formsPlugin({ strategy: 'class' }), + aspectRatio, + typography, + containerQueries, + headlessUi ], content: { files: [