mirror of
https://github.com/status-im/react-native.git
synced 2025-02-26 08:05:34 +00:00
split transformers
Reviewed By: martinbigio Differential Revision: D2567545 fb-gh-sync-id: 2e6a341885c701c6a7da35830227dbff7705255c
This commit is contained in:
parent
54b1402c43
commit
3a8f9e1080
@ -17,14 +17,12 @@ module.exports = {
|
||||
// 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')
|
||||
file.match(/node_modules\/(?!react-tools\/)/)
|
||||
) {
|
||||
return src;
|
||||
}
|
||||
|
||||
return transformer.transform(src, file).code;
|
||||
return transformer.transform(src, file, {inlineRequires: true}).code;
|
||||
},
|
||||
|
||||
getCacheKey: createCacheKeyFunction([
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user