Skip to content

fix: invalid @ rule body when using dynamic styles in pseudo elements#1486

Merged
mellyeliu merged 1 commit intofacebook:mainfrom
skovhus:kenneth/fix-invalid-at-rule-body
Feb 23, 2026
Merged

fix: invalid @ rule body when using dynamic styles in pseudo elements#1486
mellyeliu merged 1 commit intofacebook:mainfrom
skovhus:kenneth/fix-invalid-at-rule-body

Conversation

@skovhus
Copy link
Copy Markdown
Contributor

@skovhus skovhus commented Feb 16, 2026

What changed / motivation ?

Fix runtime error Invalid @ rule body when using dynamic styles in pseudo elements, such as:

const styles = stylex.create({
  repro: (var: string) => ({
    '::after': {
      color: var, // FAILS
    },
  }),
});

Linked PR/Issues

Fixes #1396

Additional Context

Steps to reproduce

  1. In this repository, use the examples/example-vite-react project.
  2. Add the following style:
const styles = stylex.create({
  repro: (color: string) => ({
    '::after': {
      color,
    },
  }),
});

Pre-flight checklist

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 16, 2026
@vercel
Copy link
Copy Markdown

vercel bot commented Feb 16, 2026

@skovhus is attempting to deploy a commit to the Meta Open Source Team on Vercel.

A member of the Team first needs to authorize it.

@mellyeliu mellyeliu merged commit 09592d0 into facebook:main Feb 23, 2026
6 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[unplugin] Invalid @ rule body when using dynamic styles in pseudo elements

2 participants