@@ -113,8 +113,15 @@ export default function tailwindcss(): Plugin[] {
113
113
114
114
async configResolved ( config ) {
115
115
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.
116
121
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
+ ) ,
118
125
)
119
126
} ,
120
127
@@ -158,9 +165,13 @@ export default function tailwindcss(): Plugin[] {
158
165
// In serve mode, we treat cssModules as a set, ignoring the value.
159
166
cssModules [ id ] = ''
160
167
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
+ //
161
172
// Wait until all other files have been processed, so we can extract all
162
173
// candidates before generating CSS.
163
- await server ?. waitForRequestsIdle ?.( id )
174
+ // await server?.waitForRequestsIdle?.(id)
164
175
165
176
let code = await transformWithPlugins ( this , id , generateCss ( src ) )
166
177
return { code }
0 commit comments