Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit 2664884

Browse files
committed
fix: add @ngtools/webpack to project deps only if
@angular-devkit/build-angular is not a dependency Revert to adding @ngtools/webpack instead of @angular-devkit/build-angular because the later is ~150mb bigger and slows down the {N} cloud builds. Add @ngtools/webpack to the project dependencies only if @angular-devkit/build-angular isn't there already. That's because the @angular-devkit/build-angular already depends on @ngtools/webpack. This will prevent the plugin from adding multiple instances of @ngtools/webpack to the project which would cause the build to fail. related to #571, #569
1 parent 5d44890 commit 2664884

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

Diff for: dependencyManager.js

+23-6
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,29 @@ function addDependency(deps, name, version, force) {
8282
}
8383

8484
function getRequiredDeps(packageJson) {
85-
return isAngular({packageJson}) ?
86-
{
87-
"@angular-devkit/build-angular": "~0.7.0-rc.0",
88-
"@angular/compiler-cli": "~6.1.0-beta.1",
89-
} :
90-
{ };
85+
if (!isAngular({packageJson})) {
86+
return false;
87+
}
88+
89+
const deps = {
90+
"@angular/compiler-cli": "~6.1.0-beta.3",
91+
};
92+
93+
if (!dependsOn(packageJson, "@angular-devkit/build-angular")) {
94+
deps["@ngtools/webpack"] = "~6.1.0-rc.0";
95+
}
96+
97+
return deps;
98+
}
99+
100+
101+
function dependsOn(packageJson, package) {
102+
if (!packageJson) {
103+
return false;
104+
}
105+
106+
return packageJson.dependencies.hasOwnProperty(package) ||
107+
packageJson.devDependencies.hasOwnProperty(package);
91108
}
92109

93110
function showHelperMessages({ newDepsAdded, hasOldDeps }) {

0 commit comments

Comments
 (0)