Only resolve package.json when relative configs are enabled (#13063)

This commit is contained in:
Nicolò Ribaudo 2021-03-28 12:04:42 +02:00 committed by GitHub
parent 8e8954b470
commit 06eb3b73cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -201,17 +201,17 @@ export function* buildRootChain(
mergeChain(configFileChain, result); mergeChain(configFileChain, result);
} }
const pkgData =
typeof context.filename === "string"
? yield* findPackageData(context.filename)
: null;
let ignoreFile, babelrcFile; let ignoreFile, babelrcFile;
let isIgnored = false; let isIgnored = false;
const fileChain = emptyChain(); const fileChain = emptyChain();
// resolve all .babelrc files // resolve all .babelrc files
if ( if (
(babelrc === true || babelrc === undefined) && (babelrc === true || babelrc === undefined) &&
typeof context.filename === "string"
) {
const pkgData = yield* findPackageData(context.filename);
if (
pkgData && pkgData &&
babelrcLoadEnabled(context, pkgData, babelrcRoots, babelrcRootsDirectory) babelrcLoadEnabled(context, pkgData, babelrcRoots, babelrcRootsDirectory)
) { ) {
@ -253,6 +253,7 @@ export function* buildRootChain(
fileChain.files.add(babelrcFile.filepath); fileChain.files.add(babelrcFile.filepath);
} }
} }
}
if (context.showConfig) { if (context.showConfig) {
console.log( console.log(