How to properly use polyfill in Angular 14 application?

Viewed 28

I have an Angular 14 application that targets the standard set of modern evergreen browsers and as a special case it should run in a Chrome 80 browser. Therefore the .browserslistrc file looks like this:

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
not IE 11

Chrome >= 80

The TS compiler is configured to output ES2020 (config from tsconfig.json):

    "target": "es2020",
    "module": "es2020",
    "lib": ["es2018", "dom"]

In our code we now want to use the Array.prototype.findLast() and Array.prototype.findLastIndex() functions that are not supported by Chrome 80.

Despite that the Chrome 80 is specified in the .browserslistrc the build output does not contain the required polyfills.

How should those polyfills be added to the application? How are polyfills meant to be used in Angular applications?
Wasn't there a change that outputs required polyfills based on the data from core-js-compat?

0 Answers
Related