Skip to content

Commit 791cf75

Browse files
committed
fix(@angular/build): check both potential build packages in Angular version check
The compatible Angular version check now supports getting the SemVer range of a compatible `@angular/compiler-cli` package from both this package and `@angular-devkit/build-angular` if present. This prevents a potential build error condition if `@angular-devkit/build-angular` is not present.
1 parent e956382 commit 791cf75

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

packages/angular/build/src/utils/version.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,17 @@ export function assertCompatibleAngularVersion(projectRoot: string): void | neve
5656
return;
5757
}
5858

59-
const supportedAngularSemver = projectRequire('@angular-devkit/build-angular/package.json')[
60-
'peerDependencies'
61-
]['@angular/compiler-cli'];
59+
let supportedAngularSemver;
60+
try {
61+
supportedAngularSemver = projectRequire('@angular/build/package.json')['peerDependencies'][
62+
'@angular/compiler-cli'
63+
];
64+
} catch {
65+
supportedAngularSemver = projectRequire('@angular-devkit/build-angular/package.json')[
66+
'peerDependencies'
67+
]['@angular/compiler-cli'];
68+
}
69+
6270
const angularVersion = new SemVer(angularPkgJson['version']);
6371

6472
if (!satisfies(angularVersion, supportedAngularSemver, { includePrerelease: true })) {

0 commit comments

Comments
 (0)