Skip to content

[astro-purgecss] new css filename is not replaced in js files #1199

@leifmarcus

Description

@leifmarcus

Describe the bug
Old css filenames will be still part of the js files in the dist folder. As Astro builds the pages using vite in the background, the css filenames will be also inside the __vite__mapDeps.

To Reproduce
I created an Astro setup on Stackblitz: https://stackblitz.com/edit/astro-purge-css-ttdz5pkh.
There, you can find an outdated css filename inside the generated OtherComponent.<hash>.js file in the dist folder after building.

  1. Go to Stackblitz
  2. run npm run build if it didn’t on startup
  3. Open the OtherComponent.<hash>.js file in the dist/_astro folder.
  4. See that there is a index.<hash>.css file, that was not replaced with the new filename.

Expected behavior
The css filenames should also be replaced inside the js files in the build output.

Screenshots
Screenshot of a file, that contains a link to a css file, that does not exist anymore in the dist folder.

Image

Additional context
Astro Version: 5.16.1
Astro PurgeCSS: 7.0.2

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions