Skip to content

[unplugin] Clear collected CSS when a module drops its StyleX import … - #2016

Open
jennymeshaiah09 wants to merge 1 commit into
meta:mainfrom
jennymeshaiah09:fix-unplugin-stale-css-on-import-removal-ae62
Open

jennymeshaiah09 wants to merge 1 commit into
meta:mainfrom
jennymeshaiah09:fix-unplugin-stale-css-on-import-removal-ae62

Conversation

@jennymeshaiah09

Copy link
Copy Markdown
Contributor

…(#2015)

transform returned early when shouldHandle became false, skipping the metadata.stylex cleanup path. Removing the last style while keeping the import already cleared CSS; dropping the import left stale rules.

What changed / motivation ?

After a successful transform, replacing a styled module with code that has no
StyleX import left its previous rules in the collected CSS. Removing the last
style while keeping the import already cleared CSS in the same sequence.
transform returned immediately at if (!shouldHandle(code)) return null.
Once the import is gone, shouldHandle is false, so the existing cleanup in
the metadata.stylex branch never runs.
On that early return, drop the module's entries from both stores, bump the
shared CSS version when entries existed, and call the existing disk-persistence
cleanup. The empty-metadata path uses the same helper.

Linked PR/Issues

Fixes # (issue)
#2015

Pre-flight checklist

…eta#2015)

transform returned early when shouldHandle became false, skipping the
metadata.stylex cleanup path. Removing the last style while keeping the
import already cleared CSS; dropping the import left stale rules.
@vercel

vercel Bot commented Nov 7, 2026

Copy link
Copy Markdown

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

A member of the Team first needs to authorize it.

@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 Nov 7, 2026

This branch has not been deployed

No deployments
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.

2 participants