Skip to content

Commit

Permalink
babel --watch should have equivalent file selection logic with `bab…
Browse files Browse the repository at this point in the history
…el` (#10283)

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

* perf: disable globbing for watch
  • Loading branch information
JLHwung authored and nicolo-ribaudo committed Dec 5, 2019
1 parent c6e966c commit c9a6898
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/babel-cli/src/babel/file.js
Expand Up @@ -216,6 +216,7 @@ export default async function({
const chokidar = util.requireChokidar();
chokidar
.watch(filenames, {
disableGlobbing: true,
persistent: true,
ignoreInitial: true,
awaitWriteFinish: {
Expand All @@ -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;
}

Expand Down

0 comments on commit c9a6898

Please sign in to comment.