Merge pull request #11494 from webpack/bugfix/yarn-2
avoid error for managed paths that only contain a node_modules
This commit is contained in:
commit
1fb44c6952
|
@ -2658,9 +2658,22 @@ class FileSystemInfo {
|
|||
if (err) {
|
||||
if (err.code === "ENOENT" || err.code === "ENOTDIR") {
|
||||
// no package.json or path is not a directory
|
||||
const problem = `Managed item ${path} isn't a directory or doesn't contain a package.json`;
|
||||
this.logger.warn(problem);
|
||||
return callback(new Error(problem));
|
||||
this.fs.readdir(path, (err, elements) => {
|
||||
if (
|
||||
!err &&
|
||||
elements.length === 1 &&
|
||||
elements[0] === "node_modules"
|
||||
) {
|
||||
// This is only a grouping folder e. g. used by yarn
|
||||
// we are only interested in existence of this special directory
|
||||
this._managedItems.set(path, "nested");
|
||||
return callback(null, "nested");
|
||||
}
|
||||
const problem = `Managed item ${path} isn't a directory or doesn't contain a package.json`;
|
||||
this.logger.warn(problem);
|
||||
return callback(new Error(problem));
|
||||
});
|
||||
return;
|
||||
}
|
||||
return callback(err);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue