Thanks to visit codestin.com
Credit goes to github.com

Skip to content

StyleX plugin does not trigger Vite file hash to update #1387

@jonreading81

Description

@jonreading81

Describe the issue

Issue: StyleX plugin does not trigger Vite file hash to update

Description

When using the StyleX plugin with Vite, the generated CSS styles are appended to the output files after the initial build. However, Vite's hashed filenames are based only on the original file content, not the appended StyleX styles. As a result, updating StyleX styles does not change the hash in the output filename, causing browsers and CDNs to serve stale CSS.

Impact

  • StyleX style changes are not reflected until a full cache purge or manual intervention.
  • Users may see outdated styles after a deployment.
  • This breaks the expected cache busting behavior of Vite's asset pipeline.

Steps to Reproduce

  1. Build the project with StyleX and Vite.
  2. Deploy and load the site.
  3. Change a StyleX style and rebuild.
  4. Observe that the output file hash does not change, and the new styles are not loaded.

Expected Behavior

Updating StyleX styles should result in a new hash for the affected output files, ensuring browsers and CDNs fetch the latest styles.

Suggested Solution

The StyleX plugin should ensure that appended styles are included in the hash calculation for output files, so any style change triggers proper cache busting.

Expected behavior

Updating StyleX styles should result in a new hash for the affected output files, ensuring browsers and CDNs fetch the latest styles.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions