saadeghi/daisyui · error · Error

Unsupported daisyUI source file: ${sourceFile}

Error message

Unsupported daisyUI source file: ${sourceFile}

What it means

After resolving the input, the script looks up sourceGroups by dirname(sourceFile). It only knows four directories: src/base, src/components, src/themes, and src/utilities (all under packages/daisyui). It throws when the dirname is not one of those, or when the file does not end in .css.

Source

Thrown at packages/playground/build-daisyui.js:36

    { type: "base", outputRoot: resolve(daisyuiRoot, "theme"), themes: true },
  ],
  [
    resolve(daisyuiRoot, "src/utilities"),
    { type: "utility", outputRoot: resolve(daisyuiRoot, "utilities") },
  ],
])

const inputFile = process.argv[2]

if (!inputFile) {
  throw new Error("A daisyUI source file is required")
}

const sourceFile = resolve(inputFile)
const sourceGroup = sourceGroups.get(dirname(sourceFile))

if (!sourceGroup || !sourceFile.endsWith(".css")) {
  throw new Error(`Unsupported daisyUI source file: ${sourceFile}`)
}

const name = basename(sourceFile, ".css")
const [styles, outputDirectory] = await Promise.all([
  cssToJs(sourceFile),
  createDirectoryBasedOnFileNames(name, ".css", sourceGroup.outputRoot),
])

await createPluginFiles(sourceGroup.type, outputDirectory, styles, name)

if (sourceGroup.themes) {
  await generateThemesObject(resolve(daisyuiRoot, "theme/object.js"))
}

View on GitHub (pinned to 42b09e637e)

Solutions

  1. Move/edit the file under packages/daisyui/src/{base,components,themes,utilities}/.
  2. Make sure the extension is exactly .css.
  3. If using a relative path, run the script from a directory where it resolves into one of the four src/ folders.

Example fix

// before
bun packages/playground/build-daisyui.js packages/daisyui/components/button.css
// after
bun packages/playground/build-daisyui.js packages/daisyui/src/components/button.css
Defensive patterns

Strategy: validation

Validate before calling

import { dirname, resolve } from 'node:path'
const daisyuiRoot = resolve(projectRoot, '../daisyui')
const allowedDirs = new Set(['base','components','themes','utilities'].map(s => resolve(daisyuiRoot, 'src', s)))
const ok = allowedDirs.has(dirname(resolve(inputFile))) && inputFile.endsWith('.css')
if (!ok) { console.error('File must be a .css under packages/daisyui/src/{base,components,themes,utilities}'); process.exit(2) }

Type guard

const isAllowedSource = (file) => file.endsWith('.css') && allowedDirs.has(dirname(resolve(file)))

Prevention

When it happens

Trigger: Passing a file outside the four known src/ subdirectories; passing a .js/.scss/.html file; passing a generated output file (e.g. under packages/daisyui/base instead of src/base); passing a docs or playground CSS file.

Common situations: Contributor edits a generated file in components/ instead of the source in src/components/; passing an absolute path whose resolved dirname does not exactly match the canonical resolved source-group path; a typo in the subdirectory name.

Related errors


AI-assisted analysis of saadeghi/daisyui@42b09e637e (2026-08-13). Data as JSON: /api/errors/72dd7ac000439ab4. Report an issue: GitHub.