Skip to content

Commit fe2dd67

Browse files
committed
Allow user to enable polling
This is necessary when watching files over a network
1 parent 1916268 commit fe2dd67

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/cli.js

Lines changed: 5 additions & 1 deletion
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,7 +369,7 @@ async function build() {
367369
let input = args['--input']
368370
let output = args['--output']
369371
let shouldWatch = args['--watch']
370-
let shouldPoll = process.platform === 'win32'
372+
let shouldPoll = args['--poll'] || process.platform === 'win32'
371373
let includePostCss = args['--postcss']
372374

373375
// Polling interval in milliseconds
@@ -751,6 +753,8 @@ async function build() {
751753
}
752754

753755
watcher = chokidar.watch([...contextDependencies, ...extractFileGlobs(config)], {
756+
usePolling: shouldPoll,
757+
interval: pollInterval,
754758
ignoreInitial: true,
755759
awaitWriteFinish:
756760
shouldPoll

0 commit comments

Comments
 (0)