babel --watch should have equivalent file selection logic with babel (#10283)

* fix(watcher): skip non-compilable file only when it is not included in filenames argument

* perf: disable globbing for watch
This commit is contained in:
Huáng Jùnliàng 2019-12-05 02:28:52 -05:00 committed by Nicolò Ribaudo
parent c6e966cac9
commit c9a68984d6

View File

@ -216,6 +216,7 @@ export default async function({
const chokidar = util.requireChokidar();
chokidar
.watch(filenames, {
disableGlobbing: true,
persistent: true,
ignoreInitial: true,
awaitWriteFinish: {
@ -224,7 +225,10 @@ export default async function({
},
})
.on("all", function(type: string, filename: string): void {
if (!util.isCompilableExtension(filename, cliOptions.extensions)) {
if (
!util.isCompilableExtension(filename, cliOptions.extensions) &&
!filenames.includes(filename)
) {
return;
}