To avoid the usage of JS functions which are not supported by some browsers we should introduce eslinter for this.
There exist a plugin for this type of linting:
npm install --save-dev eslint-plugin-compat
Based on the browserslist which can be dumped by running:
and configured the following way in the project package.json:
"browserslist": [
"> 0.25% in my stats",
"> 0.5% in CH",
"last 3 version and not dead"
]
if a polyfill is added it can be configured the following way:
{
"root": true,
"extends": [
// ...
"plugin:compat/recommended"
],
"settings": {
"polyfills": [
"fetch",
"Object.values",
"Object.assign",
"Promise",
"URL",
"URLSearchParams",
"Symbol",
"Array.keys",
"Array.from"
]
},
// ...
}
polyfills can mostly be included over the exist core-js or whatwg-fetch from github:
import 'whatwg-fetch';
import 'core-js/features/url';
import 'core-js/features/url-search-params';
import 'core-js/features/object/assign';
import 'core-js/features/object/values';
import 'core-js/features/promise';
import 'core-js/features/symbol';
import 'core-js/features/array/keys';
import 'core-js/features/array/from';
To avoid the usage of JS functions which are not supported by some browsers we should introduce eslinter for this.
There exist a plugin for this type of linting:
Based on the browserslist which can be dumped by running:
and configured the following way in the project package.json:
if a polyfill is added it can be configured the following way:
polyfills can mostly be included over the exist core-js or whatwg-fetch from github: