codiume / orbit

Collection of useful integrations & components for the Astro ecosystem. ⭐️ Star to support our work!
https://astro.build
MIT License
328 stars 12 forks source link

[astro-purgecss] CSS files not found in SSR mode as of v4.6.0 #664

Open mef opened 3 weeks ago

mef commented 3 weeks ago

A regression in v4.6.0 causes CSS files to 404 in the build for pages rendered in Astro's SSR mode.

The feature was working well in v4.5.0 and earlier version.

Side-note: this is a follow-up of a discussion started inside #660.

To Reproduce

  1. Create an astro project with page(s) rendered in SSR mode (output server or hybrid in Astro config), and some CSS somewhere.
  2. Run npm run build
  3. Run npm run preview

Expected behavior

All pages load with their CSS style correctly applied.

Observed behavior

The SSR-generated pages load with no style at all. The developer console shows error messages with CSS files not found (404).

Static pages have CSS applied as suitable.

Additional context

As of v4.5.0, astro-purgecss renames CSS files, and updates their references inside the pages consuming them.

Cause of the regression has been identified:

@the-dijkstra which approach would you like to take to fix this one?

the-dijkstra commented 3 weeks ago

Hey @mef thank you so much for this well detailed issue.

What if we add the extra step to update the manifest file ? I think this will solve the problem

maybe also worth exploring iterating through pages instead of routes https://github.com/codiume/orbit/issues/654#issuecomment-2379835208