Skip to content

Commit 6bcddb7

Browse files
committed
Merge pull request react-bootstrap#826 from Cellule/babel_internal_api
Unlink babel internal api for build
2 parents beb5142 + bda2ee6 commit 6bcddb7

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

tools/buildBabel.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import { transform } from 'babel-core';
2-
import resolveRc from 'babel-core/lib/babel/tools/resolve-rc';
3-
import * as babelUtil from 'babel-core/lib/babel/util';
42
import glob from 'glob';
53
import fs from 'fs';
64
import path from 'path';
75
import outputFileSync from 'output-file-sync';
86

97
export function buildContent(content, filename, destination, babelOptions={}) {
10-
const result = transform(content, resolveRc(filename, babelOptions));
8+
babelOptions.filename = filename;
9+
const result = transform(content, babelOptions);
1110
outputFileSync(destination, result.code, {encoding: 'utf8'});
1211
}
1312

@@ -19,11 +18,9 @@ console.warn('You can read more about it at https://github.com/react-bootstrap/r
1918
${content}`;
2019
}
2120

22-
if(babelUtil.canCompile(filename)) {
23-
// Get file basename without the extension (in case not .js)
24-
let outputName = path.basename(filename, path.extname(filename));
25-
// append the file basename with extension .js
26-
let outputPath = path.join(destination, outputName + '.js');
21+
// We only have .js files that we need to build
22+
if(path.extname(filename) === '.js') {
23+
const outputPath = path.join(destination, path.basename(filename));
2724
// console.log('%s => %s', filename, outputPath);
2825
buildContent(content, filename, outputPath, babelOptions);
2926
}

0 commit comments

Comments
 (0)