From cee01bef4fd66c041444a95e8de92185c5bbe0d3 Mon Sep 17 00:00:00 2001 From: Christoph Pojer Date: Tue, 22 Sep 2015 12:11:13 -0700 Subject: [PATCH] Don't transform node_modules in open source MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: We aren't ignoring node_modules so we apply our transform on *all of them*. See https://github.com/facebook/react-native/pull/2942 and https://github.com/facebook/react-native/issues/2939 @​public Reviewed By: @vjeux Differential Revision: D2467324 --- jestSupport/preprocessor.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/jestSupport/preprocessor.js b/jestSupport/preprocessor.js index 0e81cb382..32d691cdd 100644 --- a/jestSupport/preprocessor.js +++ b/jestSupport/preprocessor.js @@ -14,6 +14,16 @@ const transformer = require('../packager/transformer.js'); module.exports = { process(src, file) { + // Don't transform node_modules, except react-tools which includes the + // untransformed copy of React + if ( + file.match(/node_modules\/(?!react-tools\/)/) || + // (TODO: balpert, cpojer): Remove this once react is updated to 0.14 + file.endsWith('performanceNow.js') + ) { + return src; + } + return transformer.transform(src, file).code; },