Fixed ignore in readme for babel-register [skip ci] (#6899)

This commit is contained in:
Mark Shulhin 2017-11-25 00:45:49 +02:00 committed by Henry Zhu
parent 041dd4a536
commit 0056fb1cfb

View File

@ -39,7 +39,7 @@ override this by passing an ignore regex via:
require("@babel/register")({ require("@babel/register")({
// This will override `node_modules` ignoring - you can alternatively pass // This will override `node_modules` ignoring - you can alternatively pass
// an array of strings to be explicitly matched or a regex / glob // an array of strings to be explicitly matched or a regex / glob
ignore: false ignore: []
}); });
``` ```
@ -49,16 +49,16 @@ require("@babel/register")({
require("@babel/register")({ require("@babel/register")({
// Optional ignore regex - if any filenames **do** match this regex then they // Optional ignore regex - if any filenames **do** match this regex then they
// aren't compiled. // aren't compiled.
ignore: /regex/, ignore: [/regex/],
// Ignore can also be specified as a function. // Ignore can also be specified as a function.
ignore: function(filename) { ignore: [function(filename) {
if (filename === "/path/to/es6-file.js") { if (filename === "/path/to/es6-file.js") {
return false; return false;
} else { } else {
return true; return true;
} }
}, }],
// Optional only regex - if any filenames **don't** match this regex then they // Optional only regex - if any filenames **don't** match this regex then they
// aren't compiled // aren't compiled