@@ -113,8 +113,15 @@ export default function tailwindcss(): Plugin[] {
113113
114114 async configResolved ( config ) {
115115 minify = config . build . cssMinify !== false
116+ // Apply the vite:css plugin to generated CSS for transformations like
117+ // URL path rewriting and image inlining.
118+ //
119+ // In build mode, since renderChunk runs after all transformations, we
120+ // need to also apply vite:css-post.
116121 cssPlugins = config . plugins . filter ( ( plugin ) =>
117- [ 'vite:css' , 'vite:css-post' ] . includes ( plugin . name ) ,
122+ [ 'vite:css' , ...( config . command === 'build' ? [ 'vite:css-post' ] : [ ] ) ] . includes (
123+ plugin . name ,
124+ ) ,
118125 )
119126 } ,
120127
@@ -158,9 +165,13 @@ export default function tailwindcss(): Plugin[] {
158165 // In serve mode, we treat cssModules as a set, ignoring the value.
159166 cssModules [ id ] = ''
160167
168+ // TODO: Re-enable waitForRequestsIdle once issues with it hanging are
169+ // fixed. Until then, this transformation may run multiple times in
170+ // serve mode, possibly giving a FOUC.
171+ //
161172 // Wait until all other files have been processed, so we can extract all
162173 // candidates before generating CSS.
163- await server ?. waitForRequestsIdle ?.( id )
174+ // await server?.waitForRequestsIdle?.(id)
164175
165176 let code = await transformWithPlugins ( this , id , generateCss ( src ) )
166177 return { code }
0 commit comments