From fe2dd67d4567f3893e629681c40923c92daefa7d Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Wed, 2 Mar 2022 10:30:44 -0500 Subject: [PATCH] Allow user to enable polling This is necessary when watching files over a network --- src/cli.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/cli.js b/src/cli.js index bd26c0491a9b..09fbbfd199e3 100644 --- a/src/cli.js +++ b/src/cli.js @@ -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', @@ -187,6 +188,7 @@ let commands = { '-o': '--output', '-m': '--minify', '-w': '--watch', + '-p': '--poll', }, }, } @@ -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 @@ -751,6 +753,8 @@ async function build() { } watcher = chokidar.watch([...contextDependencies, ...extractFileGlobs(config)], { + usePolling: shouldPoll, + interval: pollInterval, ignoreInitial: true, awaitWriteFinish: shouldPoll