Skip to content

Commit

Permalink
fix(options): always include babel default extensions
Browse files Browse the repository at this point in the history
Unintended backcompat break occurred in 7b5eee6.

Thanks @timorthi

Fixes #122
  • Loading branch information
STRML committed Mar 5, 2021
1 parent aea3ff2 commit 5b86fc6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions babel-watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ program.option('-I, --inspect [address]', 'Enable inspect mode')
program.option('-X, --inspect-brk [address]', 'Enable inspect break mode')
program.option('-o, --only [globs]', 'Matching files will *only* be transpiled', arrayify, null);
program.option('-i, --ignore [globs]', 'Matching files will not be transpiled, but will still be watched. Default value is "node_modules". If you specify this option and still want to exclude modules, be sure to add it to the list.', arrayify, ['node_modules']);
program.option('-e, --extensions [extensions]', 'List of extensions to hook into', arrayify, babel.DEFAULT_EXTENSIONS);
program.option('-e, --extensions [extensions]', 'List of extensions to hook into', arrayify, []);
program.option('-w, --watch [dir]', 'Watch directory "dir" or files. Use once for each directory or file to watch', collect, []);
program.option('-x, --exclude [dir]', 'Exclude matching directory/files from watcher. Use once for each directory or file', collect, []);
program.option('-L, --use-polling', 'In some filesystems watch events may not work correcly. This option enables "polling" which should mitigate this type of issue');
Expand Down Expand Up @@ -121,7 +121,8 @@ const cwd = process.cwd();

const only = program.only;
const ignore = program.ignore;
const transpileExtensions = program.extensions.map((ext) => ext.trim());
// We always transpile the default babel extensions. The option only adds more.
const transpileExtensions = babel.DEFAULT_EXTENSIONS.concat(program.extensions.map((ext) => ext.trim()));
const debug = Boolean(program.debug || program.debugBrk || program.inspect || program.inspectBrk)

const mainModule = program.args[0];
Expand Down

0 comments on commit 5b86fc6

Please sign in to comment.