From d6ba4d0a24ef4b0c7d4b15096ee8dedea6702910 Mon Sep 17 00:00:00 2001 From: Logan Smyth Date: Fri, 1 Sep 2017 22:07:26 -0700 Subject: [PATCH] Only compile files inside the cwd in babel-register. (#5590) --- packages/babel-register/src/node.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/packages/babel-register/src/node.js b/packages/babel-register/src/node.js index 5513a87386..c54208afdd 100644 --- a/packages/babel-register/src/node.js +++ b/packages/babel-register/src/node.js @@ -107,16 +107,11 @@ export default function register(opts?: Object = {}) { Object.assign(transformOpts, opts); if (!transformOpts.ignore && !transformOpts.only) { + transformOpts.only = [ + // Only compile things inside the current working directory. + new RegExp("^" + escapeRegExp(process.cwd()), "i"), + ]; transformOpts.ignore = [ - // Ignore any node_modules content outside the current working directory. - new RegExp( - "^(?!" + - escapeRegExp(process.cwd()) + - ").*" + - escapeRegExp(path.sep + "node_modules" + path.sep), - "i", - ), - // Ignore any node_modules inside the current working directory. new RegExp( "^" +