diff --git a/tools/buildBabel.js b/tools/buildBabel.js index e2ef5c66e2..aae1d57738 100644 --- a/tools/buildBabel.js +++ b/tools/buildBabel.js @@ -1,23 +1,20 @@ import { transform } from 'babel-core'; -import resolveRc from 'babel-core/lib/babel/tools/resolve-rc'; -import * as babelUtil from 'babel-core/lib/babel/util'; import glob from 'glob'; import fs from 'fs'; import path from 'path'; import outputFileSync from 'output-file-sync'; export function buildContent(content, filename, destination, babelOptions={}) { - const result = transform(content, resolveRc(filename, babelOptions)); + babelOptions.filename = filename; + const result = transform(content, babelOptions); outputFileSync(destination, result.code, {encoding: 'utf8'}); } export function buildFile(filename, destination, babelOptions={}) { const content = fs.readFileSync(filename, {encoding: 'utf8'}); - if(babelUtil.canCompile(filename)) { - // Get file basename without the extension (in case not .js) - let outputName = path.basename(filename, path.extname(filename)); - // append the file basename with extension .js - let outputPath = path.join(destination, outputName + '.js'); + // We only have .js files that we need to build + if(path.extname(filename) === '.js') { + const outputPath = path.join(destination, path.basename(filename)); // console.log('%s => %s', filename, outputPath); buildContent(content, filename, outputPath, babelOptions); }