From 76d6d8826f9968f84edf219f67b84673d70bbe95 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Fri, 27 Aug 2021 14:51:00 +0200 Subject: [PATCH] fix(@angular-devkit/build-angular): set browserslist defaults By default, browserslist defaults are too inclusive: https://github.com/browserslist/browserslist/blob/83764ea81ffaa39111c204b02c371afa44a4ff07/index.js#L516-L522 We change the default query to browsers that Angular support: https://angular.io/guide/browser-support --- .../src/utils/build-browser-features.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/angular_devkit/build_angular/src/utils/build-browser-features.ts b/packages/angular_devkit/build_angular/src/utils/build-browser-features.ts index 8a06094d6988..f2c31e6571fd 100644 --- a/packages/angular_devkit/build_angular/src/utils/build-browser-features.ts +++ b/packages/angular_devkit/build_angular/src/utils/build-browser-features.ts @@ -13,6 +13,20 @@ export class BuildBrowserFeatures { readonly supportedBrowsers: string[]; constructor(private projectRoot: string) { + // By default, browserslist defaults are too inclusive + // https://github.com/browserslist/browserslist/blob/83764ea81ffaa39111c204b02c371afa44a4ff07/index.js#L516-L522 + + // We change the default query to browsers that Angular support. + // https://angular.io/guide/browser-support + browserslist.defaults = [ + 'last 1 Chrome version', + 'last 1 Firefox version', + 'last 2 Edge major versions', + 'last 2 Safari major versions', + 'last 2 iOS major versions', + 'Firefox ESR', + ]; + this.supportedBrowsers = browserslist(undefined, { path: this.projectRoot }); }