Skip to content

Commit

Permalink
Allow user to enable polling
Browse files Browse the repository at this point in the history
This is necessary when watching files over a network
  • Loading branch information
thecrypticace committed Mar 2, 2022
1 parent 1916268 commit fe2dd67
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ let commands = {
'--input': { type: String, description: 'Input file' },
'--output': { type: String, description: 'Output file' },
'--watch': { type: Boolean, description: 'Watch for changes and rebuild as needed' },
'--poll': { type: Boolean, description: 'Poll for changes every so often and rebuild' },
'--content': {
type: String,
description: 'Content paths to use for removing unused classes',
Expand All @@ -187,6 +188,7 @@ let commands = {
'-o': '--output',
'-m': '--minify',
'-w': '--watch',
'-p': '--poll',
},
},
}
Expand Down Expand Up @@ -367,7 +369,7 @@ async function build() {
let input = args['--input']
let output = args['--output']
let shouldWatch = args['--watch']
let shouldPoll = process.platform === 'win32'
let shouldPoll = args['--poll'] || process.platform === 'win32'
let includePostCss = args['--postcss']

// Polling interval in milliseconds
Expand Down Expand Up @@ -751,6 +753,8 @@ async function build() {
}

watcher = chokidar.watch([...contextDependencies, ...extractFileGlobs(config)], {
usePolling: shouldPoll,
interval: pollInterval,
ignoreInitial: true,
awaitWriteFinish:
shouldPoll
Expand Down

0 comments on commit fe2dd67

Please sign in to comment.