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