Only resolve package.json when relative configs are enabled (#13063)
This commit is contained in:
parent
8e8954b470
commit
06eb3b73cb
@ -201,56 +201,57 @@ 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) &&
|
||||||
pkgData &&
|
typeof context.filename === "string"
|
||||||
babelrcLoadEnabled(context, pkgData, babelrcRoots, babelrcRootsDirectory)
|
|
||||||
) {
|
) {
|
||||||
({ ignore: ignoreFile, config: babelrcFile } = yield* findRelativeConfig(
|
const pkgData = yield* findPackageData(context.filename);
|
||||||
pkgData,
|
|
||||||
context.envName,
|
|
||||||
context.caller,
|
|
||||||
));
|
|
||||||
|
|
||||||
if (ignoreFile) {
|
|
||||||
fileChain.files.add(ignoreFile.filepath);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
ignoreFile &&
|
pkgData &&
|
||||||
shouldIgnore(context, ignoreFile.ignore, null, ignoreFile.dirname)
|
babelrcLoadEnabled(context, pkgData, babelrcRoots, babelrcRootsDirectory)
|
||||||
) {
|
) {
|
||||||
isIgnored = true;
|
({ ignore: ignoreFile, config: babelrcFile } = yield* findRelativeConfig(
|
||||||
}
|
pkgData,
|
||||||
|
context.envName,
|
||||||
|
context.caller,
|
||||||
|
));
|
||||||
|
|
||||||
if (babelrcFile && !isIgnored) {
|
if (ignoreFile) {
|
||||||
const validatedFile = validateBabelrcFile(babelrcFile);
|
fileChain.files.add(ignoreFile.filepath);
|
||||||
const babelrcLogger = new ConfigPrinter();
|
|
||||||
const result = yield* loadFileChain(
|
|
||||||
validatedFile,
|
|
||||||
context,
|
|
||||||
undefined,
|
|
||||||
babelrcLogger,
|
|
||||||
);
|
|
||||||
if (!result) {
|
|
||||||
isIgnored = true;
|
|
||||||
} else {
|
|
||||||
babelRcReport = yield* babelrcLogger.output();
|
|
||||||
mergeChain(fileChain, result);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (babelrcFile && isIgnored) {
|
if (
|
||||||
fileChain.files.add(babelrcFile.filepath);
|
ignoreFile &&
|
||||||
|
shouldIgnore(context, ignoreFile.ignore, null, ignoreFile.dirname)
|
||||||
|
) {
|
||||||
|
isIgnored = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (babelrcFile && !isIgnored) {
|
||||||
|
const validatedFile = validateBabelrcFile(babelrcFile);
|
||||||
|
const babelrcLogger = new ConfigPrinter();
|
||||||
|
const result = yield* loadFileChain(
|
||||||
|
validatedFile,
|
||||||
|
context,
|
||||||
|
undefined,
|
||||||
|
babelrcLogger,
|
||||||
|
);
|
||||||
|
if (!result) {
|
||||||
|
isIgnored = true;
|
||||||
|
} else {
|
||||||
|
babelRcReport = yield* babelrcLogger.output();
|
||||||
|
mergeChain(fileChain, result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (babelrcFile && isIgnored) {
|
||||||
|
fileChain.files.add(babelrcFile.filepath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user