File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -36,15 +36,17 @@ if (require.main === module) {
36
36
}
37
37
}
38
38
39
+ function babelBuild ( srcPath , envName ) {
40
+ return babel . transformFileSync ( srcPath , { envName } ) . code + '\n' ;
41
+ }
42
+
39
43
function buildJSFile ( filepath ) {
40
44
const srcPath = path . join ( './src' , filepath ) ;
41
45
const destPath = path . join ( './dist' , filepath ) ;
42
- const cjs = babel . transformFileSync ( srcPath , { envName : 'cjs' } ) ;
43
- const mjs = babel . transformFileSync ( srcPath , { envName : 'mjs' } ) ;
44
46
45
47
copyFile ( srcPath , destPath + '.flow' ) ;
46
- writeFile ( destPath , cjs . code ) ;
47
- writeFile ( destPath . replace ( / \. j s $ / , '.mjs' ) , mjs . code ) ;
48
+ writeFile ( destPath , babelBuild ( srcPath , ' cjs' ) ) ;
49
+ writeFile ( destPath . replace ( / \. j s $ / , '.mjs' ) , babelBuild ( srcPath , ' mjs' ) ) ;
48
50
}
49
51
50
52
function buildPackageJSON ( ) {
You can’t perform that action at this time.
0 commit comments