diff --git a/packages/angular_devkit/architect/node/node-modules-architect-host.ts b/packages/angular_devkit/architect/node/node-modules-architect-host.ts index c7ee4d85f576..feb90e803b4a 100644 --- a/packages/angular_devkit/architect/node/node-modules-architect-host.ts +++ b/packages/angular_devkit/architect/node/node-modules-architect-host.ts @@ -193,28 +193,22 @@ export class WorkspaceNodeModulesArchitectHost implements ArchitectHost "${builder.schema}"`, + `Package "${packageName}" has an invalid builder schema path: "${builderName}" --> "${builder.schema}"`, ); } // The file could be either a package reference or in the local manifest directory. - // Node resolution is tried first then reading the file from the manifest directory if resolution fails. - try { - schemaPath = localRequire.resolve(schemaPath, { - paths: [buildersManifestDirectory], - }); - } catch (e) { - if ((e as NodeJS.ErrnoException).code === 'MODULE_NOT_FOUND') { - schemaPath = path.join(buildersManifestDirectory, schemaPath); - } else { - throw e; - } + if (schemaPath.startsWith('.')) { + schemaPath = path.join(buildersManifestDirectory, schemaPath); + } else { + const manifestRequire = createRequire(buildersManifestDirectory + '/'); + schemaPath = manifestRequire.resolve(schemaPath); } const schemaText = readFileSync(schemaPath, 'utf-8');