Skip to content

Commit bb69168

Browse files
committed
Allow user to enable polling
1 parent 2cdedf5 commit bb69168

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/cli.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ 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': { type: Boolean, description: 'Poll for changes every so often and rebuild' },
164165
'--content': {
165166
type: String,
166167
description: 'Content paths to use for removing unused classes',
@@ -187,6 +188,7 @@ let commands = {
187188
'-o': '--output',
188189
'-m': '--minify',
189190
'-w': '--watch',
191+
'-p': '--poll',
190192
},
191193
},
192194
}
@@ -367,11 +369,12 @@ async function build() {
367369
let input = args['--input']
368370
let output = args['--output']
369371
let shouldWatch = args['--watch']
370-
let shouldCoalesceWriteEvents = process.platform === 'win32'
372+
let shouldPoll = args['--poll']
373+
let shouldCoalesceWriteEvents = shouldPoll || process.platform === 'win32'
371374
let includePostCss = args['--postcss']
372375

373376
// Polling interval in milliseconds
374-
// Used only when coalescing add/change events on Windows
377+
// Used only when polling or coalescing add/change events on Windows
375378
let pollInterval = 10
376379

377380
// TODO: Deprecate this in future versions
@@ -751,6 +754,8 @@ async function build() {
751754
}
752755

753756
watcher = chokidar.watch([...contextDependencies, ...extractFileGlobs(config)], {
757+
usePolling: shouldPoll,
758+
interval: shouldPoll ? pollInterval : undefined,
754759
ignoreInitial: true,
755760
awaitWriteFinish:
756761
shouldCoalesceWriteEvents

0 commit comments

Comments
 (0)