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

Commit 7b15418

Browse files
authored
fix: add @ngtools/webpack to project deps only if @angular-devkit/build-angular is not a dependency (#594)
* 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 BREAKING CHANGES Not really a breaking change but: It's a good idea to remove the `@angular-devkit/build-angular` from the package.json and add `@ngtools/webpack` instead as this will speed up the build. fixes #595 * test(e2e): update demo Angular deps
1 parent 5d44890 commit 7b15418

File tree

2 files changed

+24
-8
lines changed

2 files changed

+24
-8
lines changed

Diff for: demo/AngularApp/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"zone.js": "^0.8.4"
3030
},
3131
"devDependencies": {
32-
"@angular-devkit/build-angular": "~0.7.0-beta.1",
32+
"@ngtools/webpack": "~6.1.0-rc.0",
3333
"@angular/compiler-cli": "~6.1.0-beta.1",
3434
"@types/chai": "^4.0.2",
3535
"@types/mocha": "^2.2.41",

Diff for: dependencyManager.js

+23-7
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ function removeObsoleteDeps(packageJson) {
5656
"nativescript-worker-loader",
5757
"extract-text-webpack-plugin",
5858
"uglifyjs-webpack-plugin",
59-
"@ngtools/webpack",
6059
"@angular-devkit/core",
6160
"resolve-url-loader",
6261
"awesome-typescript-loader",
@@ -82,12 +81,29 @@ function addDependency(deps, name, version, force) {
8281
}
8382

8483
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-
{ };
84+
if (!isAngular({packageJson})) {
85+
return false;
86+
}
87+
88+
const deps = {
89+
"@angular/compiler-cli": "~6.1.0-beta.3",
90+
};
91+
92+
if (!dependsOn(packageJson, "@angular-devkit/build-angular")) {
93+
deps["@ngtools/webpack"] = "~6.1.0-rc.0";
94+
}
95+
96+
return deps;
97+
}
98+
99+
100+
function dependsOn(packageJson, package) {
101+
if (!packageJson) {
102+
return false;
103+
}
104+
105+
return packageJson.dependencies.hasOwnProperty(package) ||
106+
packageJson.devDependencies.hasOwnProperty(package);
91107
}
92108

93109
function showHelperMessages({ newDepsAdded, hasOldDeps }) {

0 commit comments

Comments
 (0)