What is the "Angular way" of supporting old browsers?
By default an Angular 14 app (built with angular-cli
) supports only 20% of the browsers (browsersl.ist).
Despite reading the relevant documentation, it is not clear to me how to enable support for older browsers too.
Changed .browserslistrc
:
By default angular-cli (v14) generates this config:
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
I have modified this to the below. The coverage coverage should go from 20% goes up to 90%. However, still older devices are showing the "white screen of death".
> 0.2%, not dead
Some other related files:
tsConfig.json
Here angular cli (v14) puts these by default:
...
"target": "es2020",
"module": "es2020",
"lib": [
"es2020",
"dom"
],
...
So, am I supposed to modify this?
I've seen approaches that use separate tsConfig.json
, for providing es6
support too.
polyfills.js
:
This file is supposed to provide "fills" for older browsers. However, from what I've read, here we should append only stuff unrelated to Angular, as anything that is angular-related will be automatically appended by the framework. Is my understanding correct?
Which is why the auto-generated polyfills.ts
has the below section empty, without any inclussions)
// .... other stuff
/***************************************************************************************************
* BROWSER POLYFILLS
*/
// ... stuff after polyfills