2016-12-10 15:24:01 +00:00
|
|
|
var babel = require("babel-core");
|
2017-01-15 17:19:53 +00:00
|
|
|
require("babel-preset-react");
|
|
|
|
require("babel-preset-es2015");
|
|
|
|
require("babel-preset-es2016");
|
|
|
|
require("babel-preset-es2017");
|
2016-12-10 15:24:01 +00:00
|
|
|
|
|
|
|
module.exports = function(embark) {
|
|
|
|
|
|
|
|
embark.registerPipeline(function(opts) {
|
|
|
|
var targetFile = opts.targetFile;
|
|
|
|
var source = opts.source;
|
|
|
|
|
|
|
|
if (targetFile.split('.').slice(-1)[0] !== 'js' ) {
|
|
|
|
return source;
|
|
|
|
}
|
|
|
|
|
2017-01-15 17:19:53 +00:00
|
|
|
return babel.transform(source, {minified: true, presets: ['es2015', 'es2016', 'es2017', 'react']}).code;
|
2016-12-10 15:24:01 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
};
|