diff --git a/packages/schematics/angular/migrations/update-12/update-angular-config.ts b/packages/schematics/angular/migrations/update-12/update-angular-config.ts index eddfcf5b4c29..f0dbe9d3e937 100644 --- a/packages/schematics/angular/migrations/update-12/update-angular-config.ts +++ b/packages/schematics/angular/migrations/update-12/update-angular-config.ts @@ -14,11 +14,11 @@ type BuilderOptionsType = Readonly<[optionName: string, oldDefault: JsonValue | const BrowserBuilderOptions: BuilderOptionsType = [ ['aot', false, true], ['vendorChunk', true, false], - ['extractLicenses', true, false], + ['extractLicenses', false, true], ['buildOptimizer', false, true], ['sourceMap', true, false], ['optimization', false, true], - ['namedChunks', false, true], + ['namedChunks', true, false], ]; const ServerBuilderOptions: BuilderOptionsType = [ diff --git a/packages/schematics/angular/migrations/update-12/update-angular-config_spec.ts b/packages/schematics/angular/migrations/update-12/update-angular-config_spec.ts index 673e72e3b3fa..bc9d1c5989a2 100644 --- a/packages/schematics/angular/migrations/update-12/update-angular-config_spec.ts +++ b/packages/schematics/angular/migrations/update-12/update-angular-config_spec.ts @@ -32,6 +32,7 @@ function createWorkSpaceConfig(tree: UnitTestTree) { optimization: true, experimentalRollupPass: false, buildOptimizer: false, + namedChunks: true, // tslint:disable-next-line:no-any } as any, configurations: { @@ -106,4 +107,12 @@ describe(`Migration to update 'angular.json'. ${schematicName}`, () => { expect(configurations?.two.sourceMap).toBeUndefined(); expect(configurations?.two.optimization).toBeFalse(); }); + + it(`should not remove value in "options" when value is not the new default`, async () => { + const newTree = await schematicRunner.runSchematicAsync(schematicName, {}, tree).toPromise(); + const { options } = getBuildTarget(newTree); + + expect(options.namedChunks).toBeTrue(); + expect(options.buildOptimizer).toBeFalse(); + }); });