Vite plugin works differently for CSS files in `astro dev` vs. `astro build`
What version of astro are you using?
Are you using an SSR adapter? If so, which one?
What package manager are you using?
What operating system are you using?
Describe the Bug
I've written a plugin that works with Vite in a similar vein to postcss-modules. The stylesheet is processed and JSON is returned to the component in place of the CSS file. However, astro build does not run the plugin for CSS/SCSS files as expected during the build process.
I've attached a couple of images and a very small reproducible demo using a very scaled back plugin that simply replaces .example.css files with a string for component consumption.
Link to Minimal Reproducible Example
[X] I am willing to submit a pull request for this issue.
Thanks for taking a look! I've been experimenting with the CSS build side of things off an on since the 1.0 release and in my attempts to work around the above issue I found that disabling the vite.build.cssCodeSplit option also breaks all CSS in the production build for Astro (#4413).
I'm not sure if the issues are related, though it should be noted that disabling cssCodeSplitting does fix the text issue above, just breaks all CSS in production builds.