Skip to content

Commit 61bc61c

Browse files
committed
fix: don't read babelrc by default
1 parent ab03c3b commit 61bc61c

File tree

5 files changed

+40
-225
lines changed

5 files changed

+40
-225
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"@babel/preset-flow": "^7.9.0",
3838
"@babel/preset-react": "^7.9.4",
3939
"@babel/preset-typescript": "^7.9.0",
40+
"browserslist": "^4.12.0",
4041
"chalk": "^4.0.0",
4142
"cosmiconfig": "^6.0.0",
4243
"cross-spawn": "^7.0.2",
@@ -60,6 +61,7 @@
6061
"@commitlint/config-conventional": "^8.3.4",
6162
"@release-it/conventional-changelog": "^1.1.4",
6263
"@types/babel__core": "^7.1.7",
64+
"@types/browserslist": "^4.8.0",
6365
"@types/chalk": "^2.2.0",
6466
"@types/cross-spawn": "^6.0.1",
6567
"@types/dedent": "^0.7.0",

src/targets/commonjs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export default async function build({
3232
modules: 'commonjs',
3333
babelrc: options?.babelrc,
3434
configFile: options?.configFile,
35-
copyFlow: options?.copyFlow ? true : false,
35+
copyFlow: options?.copyFlow,
3636
report,
3737
});
3838
}

src/targets/module.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export default async function build({
3232
modules: false,
3333
babelrc: options?.babelrc,
3434
configFile: options?.configFile,
35-
copyFlow: options?.copyFlow ? true : false,
35+
copyFlow: options?.copyFlow,
3636
report,
3737
});
3838
}

src/utils/compile.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,23 @@ import path from 'path';
22
import fs from 'fs-extra';
33
import chalk from 'chalk';
44
import * as babel from '@babel/core';
5+
import browserslist from 'browserslist';
56
import glob from 'glob';
67
import { Input } from '../types';
78

89
type Options = Input & {
9-
babelrc?: boolean | null;
10-
configFile?: string | false | null;
10+
babelrc?: boolean | null | undefined;
11+
configFile?: string | false | null | undefined;
1112
modules: 'commonjs' | false;
12-
copyFlow: boolean;
13+
copyFlow: boolean | undefined;
1314
};
1415

1516
export default async function compile({
1617
root,
1718
source,
1819
output,
19-
babelrc,
20-
configFile,
20+
babelrc = false,
21+
configFile = false,
2122
modules,
2223
copyFlow,
2324
report,
@@ -62,7 +63,8 @@ export default async function compile({
6263
[
6364
require.resolve('@babel/preset-env'),
6465
{
65-
targets: {
66+
// @ts-ignore
67+
targets: browserslist.findConfig(root) ?? {
6668
browsers: [
6769
'>1%',
6870
'last 2 chrome versions',

0 commit comments

Comments
 (0)