swc-project/swc · error · swc_css_parser::Error

@value at-rule is deprecated

Error message

@value at-rule is deprecated

What it means

With css_modules enabled, the deprecated css-modules @value at-rule is still parsed but the parser pushes this deprecation error (ErrorKind::ValueAtRule) at the at-rule's span and then ignores the rule. It is a deprecation signal, not a hard parse failure.

Source

Thrown at crates/swc_css_parser/src/parser/at_rules/mod.rs:428

                None
            }
            "scope" => {
                self.input.skip_ws();

                let prelude = AtRulePrelude::ScopePrelude(self.parse()?);

                self.input.skip_ws();

                Some(prelude)
            }

            "value" => {
                if self.config.css_modules {
                    let span = self.input.cur_span();
                    let _: ComponentValue = self.parse()?;

                    self.errors.push(Error::new(span, ErrorKind::ValueAtRule));

                    self.input.skip_ws();
                }

                return Err(Error::new(Default::default(), ErrorKind::Ignore));
            }
            _ => {
                return Err(Error::new(Default::default(), ErrorKind::Ignore));
            }
        };

        if !is!(self, EOF) {
            let span = self.input.cur_span();

            return Err(Error::new(
                span,
                ErrorKind::Unexpected("tokens in at-rule prelude"),
            ));

View on GitHub (pinned to 5176682b65)

Solutions

  1. Replace @value with standard custom properties (var(--x))
  2. Filter or downgrade the ValueAtRule error to a warning in your error handling
  3. Disable css_modules if @value support is irrelevant
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/swc_css_parser/src/parser/at_rules/mod.rs:428 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of swc-project/swc@5176682b65 (2026-08-17). Data as JSON: /api/errors/b63304a2bc3d9471. Report an issue: GitHub.