@@ -161,6 +161,10 @@ let commands = {
161161 '--input' : { type : String , description : 'Input file' } ,
162162 '--output' : { type : String , description : 'Output file' } ,
163163 '--watch' : { type : Boolean , description : 'Watch for changes and rebuild as needed' } ,
164+ '--poll' : {
165+ type : Boolean ,
166+ description : 'Use polling instead of filesystem events when watching' ,
167+ } ,
164168 '--content' : {
165169 type : String ,
166170 description : 'Content paths to use for removing unused classes' ,
@@ -187,6 +191,7 @@ let commands = {
187191 '-o' : '--output' ,
188192 '-m' : '--minify' ,
189193 '-w' : '--watch' ,
194+ '-p' : '--poll' ,
190195 } ,
191196 } ,
192197}
@@ -367,8 +372,14 @@ async function build() {
367372 let input = args [ '--input' ]
368373 let output = args [ '--output' ]
369374 let shouldWatch = args [ '--watch' ]
375+ let shouldPoll = args [ '--poll' ]
376+ let shouldCoalesceWriteEvents = shouldPoll || process . platform === 'win32'
370377 let includePostCss = args [ '--postcss' ]
371378
379+ // Polling interval in milliseconds
380+ // Used only when polling or coalescing add/change events on Windows
381+ let pollInterval = 10
382+
372383 // TODO: Deprecate this in future versions
373384 if ( ! input && args [ '_' ] [ 1 ] ) {
374385 console . error ( '[deprecation] Running tailwindcss without -i, please provide an input file.' )
@@ -746,14 +757,15 @@ async function build() {
746757 }
747758
748759 watcher = chokidar . watch ( [ ...contextDependencies , ...extractFileGlobs ( config ) ] , {
760+ usePolling : shouldPoll ,
761+ interval : shouldPoll ? pollInterval : undefined ,
749762 ignoreInitial : true ,
750- awaitWriteFinish :
751- process . platform === 'win32'
752- ? {
753- stabilityThreshold : 50 ,
754- pollInterval : 10 ,
755- }
756- : false ,
763+ awaitWriteFinish : shouldCoalesceWriteEvents
764+ ? {
765+ stabilityThreshold : 50 ,
766+ pollInterval : pollInterval ,
767+ }
768+ : false ,
757769 } )
758770
759771 let chain = Promise . resolve ( )
0 commit comments