From c9510765a44abd3887c13272e23d8f560a624a07 Mon Sep 17 00:00:00 2001 From: Bhuwan Khattar Date: Wed, 21 Oct 2015 16:25:24 -0700 Subject: [PATCH] split transformers Reviewed By: martinbigio Differential Revision: D2567545 fb-gh-sync-id: 2e6a341885c701c6a7da35830227dbff7705255c --- transformer.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/transformer.js b/transformer.js index 1dff51b8..7109574e 100644 --- a/transformer.js +++ b/transformer.js @@ -14,9 +14,14 @@ const babel = require('babel-core'); const inlineRequires = require('fbjs-scripts/babel/inline-requires'); function transform(src, filename, options) { + options = options || {}; const plugins = []; - if (process.env.NODE_ENV === 'test') { + if ( + options.inlineRequires && + // (TODO: balpert, cpojer): Remove this once react is updated to 0.14 + !filename.endsWith('performanceNow.js') + ) { plugins.push({ position: 'after', transformer: inlineRequires, @@ -63,7 +68,7 @@ function transform(src, filename, options) { module.exports = function(data, callback) { let result; try { - result = transform(data.sourceCode, data.filename); + result = transform(data.sourceCode, data.filename, data.options); } catch (e) { callback(e); return;