Bail internal transforms if there're no transforms to run

Reviewed By: sam-swarr

Differential Revision: D2810474

fb-gh-sync-id: d5ba48922c91c3dbacfccb0d087cc1deac14fa1c
This commit is contained in:
Martín Bigio 2016-01-06 20:03:30 -08:00 committed by facebook-github-bot-8
parent 85c016df31
commit db91ff81fd
1 changed files with 9 additions and 1 deletions

View File

@ -15,6 +15,14 @@ var Transforms = require('../transforms');
// transforms should be run after the external ones to ensure that they run on
// Javascript code
function internalTransforms(sourceCode, filename, options) {
var plugins = Transforms.getAll(options);
if (plugins.length === 0) {
return {
code: sourceCode,
filename: filename,
};
}
var result = babel.transform(sourceCode, {
retainLines: true,
compact: true,
@ -22,7 +30,7 @@ function internalTransforms(sourceCode, filename, options) {
filename: filename,
sourceFileName: filename,
sourceMaps: false,
plugins: Transforms.getAll(options)
plugins: plugins,
});
return {