Skip to content

Parser emits "Unexpected token Delim('*')" / "Delim('.')" warnings for selectors containing var() arguments ending in wildcard token #1293

Description

@SoulWayy

Title:
Parser emits "Unexpected token Delim('*')" / "Delim('.')" warnings for selectors containing var() arguments ending in wildcard token

Body:

Summary

Lightning CSS 1.31.1 (used transitively via Vite 7) emits non-blocking Unexpected token Delim('<char>') warnings when scanning CSS selectors whose argument is a var() whose name contains a wildcard token. Conversely, normal var()-containing selectors parse without warning. Three warnings surface per Tailwind v4 build where @theme declares font-family slots.

Environment

  • lightningcss 1.31.1 (1.32.0 latest; warning persists after bumping)
  • vite 7.3.5
  • tailwindcss 4.2.1
  • Upstream reproducer: same as in tailwindlabs/tailwindcss issue filed in parallel

Warning text

(font-[family-name:var(--font-*)])  -- Unexpected token Delim('*')
(font-[family-name:var(...)])       -- Unexpected token Delim('.')
(font-[family-name:var(...)])       -- Unexpected token Delim('.')
  • The first warning is for a literal '*' glyph (the wildcard token).
  • The second/third are for literal '.' glyphs (likely the closure of the selector parenthesised argument).

Expected

  • Either accept the wildcard as a valid selector token (same way other CSS variants parse font-[family-name:var(--font-foo)] cleanly), OR suppress this specific parse path.
  • Warnings should not be emitted for SELECTORS that will never match (the synthesised pattern has no real DOM anchor) because nothing in the user's source emits font-[family-name:...] — the keyword is purely an autosynthesised Tailwind v4 selector.

Actual

Three non-blocking warnings per vite build. Build rc=0; warning does not affect output. Wastes reviewer attention on what looks like a typo bug.

Tracking

  • chefgroep.nl .agent/state/archive/chef-1045-evidence.md
  • chefgroep.nl frontend/src/config/build-css-warning.test.ts
  • Parallel issue filed on tailwindlabs/tailwindcss for the synthesised selector at the source

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions