Skip to content

Commit 605838b

Browse files
alan-agius4mgechev
authored andcommitted
fix(@angular/cli): favor dirname when resolving @schematics/angular
This ensures that the correct build-in version of `@schematics/angular` is resolved. Closes #18840
1 parent ed6aeea commit 605838b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/angular/cli/models/schematic-command.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,10 @@ export abstract class SchematicCommand<
256256
registry: new schema.CoreSchemaRegistry(formats.standardFormats),
257257
resolvePaths: !!this.workspace.configFile
258258
// Workspace
259-
? [process.cwd(), this.workspace.root, __dirname]
259+
? this.collectionName === this.defaultCollectionName
260+
// Favor __dirname for @schematics/angular to use the build-in version
261+
? [__dirname, process.cwd(), this.workspace.root]
262+
: [process.cwd(), this.workspace.root, __dirname]
260263
// Global
261264
: [__dirname, process.cwd()],
262265
});

0 commit comments

Comments
 (0)