Skip to content

Commit eb42a47

Browse files
committed
feat: expand browser support to widely available Baseline
This commit updates the `browserslist` configuration to use browsers generated by Baseline. The exact list is pulled from angular/angular-cli#30036. Ideally this should be generated at build time from a raw date string like the Angular CLI repo does, however this would duplicate the tooling and isn't strictly necessary anyways as the release process already requires extracting the generated browser versions purely for documentation. Also copying that configuration to `ng-packagr` is not significantly more toil.
1 parent e2d9ef0 commit eb42a47

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

.browserslistrc

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# From "widely available" Baseline for 2025-03-31.
2+
Chrome >= 107
3+
ChromeAndroid >= 107
4+
Edge >= 107
5+
Firefox >= 104
6+
FirefoxAndroid >= 104
7+
Safari >= 16
8+
iOS >= 16

scripts/postbuild.js

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const { readFileSync, copyFileSync, writeFileSync, constants, mkdirSync } = requ
22

33
copyFileSync('LICENSE', 'dist/LICENSE', constants.COPYFILE_FICLONE);
44
copyFileSync('README.md', 'dist/README.md', constants.COPYFILE_FICLONE);
5+
copyFileSync('.browserslistrc', 'dist/.browserslistrc', constants.COPYFILE_FICLONE);
56
copyFileSync('src/ng-package.schema.json', 'dist/ng-package.schema.json', constants.COPYFILE_FICLONE);
67
copyFileSync('src/ng-entrypoint.schema.json', 'dist/ng-entrypoint.schema.json', constants.COPYFILE_FICLONE);
78

src/lib/styles/stylesheet-processor.ts

+4-9
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,10 @@ export class StylesheetProcessor extends ComponentStylesheetBundler {
2121
// By default, browserslist defaults are too inclusive
2222
// https://github.com/browserslist/browserslist/blob/83764ea81ffaa39111c204b02c371afa44a4ff07/index.js#L516-L522
2323
// We change the default query to browsers that Angular support.
24-
// https://angular.io/guide/browser-support
25-
(browserslist.defaults as string[]) = [
26-
'last 2 Chrome versions',
27-
'last 1 Firefox version',
28-
'last 2 Edge major versions',
29-
'last 2 Safari major versions',
30-
'last 2 iOS major versions',
31-
'Firefox ESR',
32-
];
24+
// https://angular.dev/reference/versions#browser-support
25+
(browserslist.defaults as string[]) = browserslist(undefined, {
26+
path: require.resolve('../../../.browserslistrc'),
27+
});
3328

3429
const browserslistData = browserslist(undefined, { path: basePath });
3530
const searchDirs = generateSearchDirectories([projectBasePath]);

0 commit comments

Comments
 (0)