Skip to content

Commit 0ca35b1

Browse files
committed
fix(@schematics/angular): fix migration for namedChunks and option
Both values of `extractLicenses` and `namedChunks` were inverted. (cherry picked from commit decaef5)
1 parent 294642f commit 0ca35b1

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

packages/schematics/angular/migrations/update-12/update-angular-config.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ type BuilderOptionsType = Readonly<[optionName: string, oldDefault: JsonValue |
1414
const BrowserBuilderOptions: BuilderOptionsType = [
1515
['aot', false, true],
1616
['vendorChunk', true, false],
17-
['extractLicenses', true, false],
17+
['extractLicenses', false, true],
1818
['buildOptimizer', false, true],
1919
['sourceMap', true, false],
2020
['optimization', false, true],
21-
['namedChunks', false, true],
21+
['namedChunks', true, false],
2222
];
2323

2424
const ServerBuilderOptions: BuilderOptionsType = [

packages/schematics/angular/migrations/update-12/update-angular-config_spec.ts

+9
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ function createWorkSpaceConfig(tree: UnitTestTree) {
3232
optimization: true,
3333
experimentalRollupPass: false,
3434
buildOptimizer: false,
35+
namedChunks: true,
3536
// tslint:disable-next-line:no-any
3637
} as any,
3738
configurations: {
@@ -106,4 +107,12 @@ describe(`Migration to update 'angular.json'. ${schematicName}`, () => {
106107
expect(configurations?.two.sourceMap).toBeUndefined();
107108
expect(configurations?.two.optimization).toBeFalse();
108109
});
110+
111+
it(`should not remove value in "options" when value is not the new default`, async () => {
112+
const newTree = await schematicRunner.runSchematicAsync(schematicName, {}, tree).toPromise();
113+
const { options } = getBuildTarget(newTree);
114+
115+
expect(options.namedChunks).toBeTrue();
116+
expect(options.buildOptimizer).toBeFalse();
117+
});
109118
});

0 commit comments

Comments
 (0)