11import { 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' ;
42import glob from 'glob' ;
53import fs from 'fs' ;
64import path from 'path' ;
75import outputFileSync from 'output-file-sync' ;
86
97export 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