polyfills.ts
/**
This polyfills.ts file is essential for Angular and loads before the main app.
You have the option to add custom polyfills to this file as needed.
*
The file is structured into two main sections:
- Browser polyfills. These are applied prior to loading ZoneJS, organized by browser compatibility.
- Application imports. Files that are imported post ZoneJS and need to load before the main
file.
*
The current configuration caters to "evergreen" browsers; the latest versions of browsers that
auto-update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
Edge >= 13 on desktop, and iOS 10 and Chrome on mobile.
*
For more details, visit https://angular.io/docs/ts/latest/guide/browser-support.html
*/
/***************************************************************************************************
/** The following polyfills are required for IE9, IE10, and IE11. **/
import 'core-js/es6/symbol';
import 'core-js/es6/object';
import 'core-js/es6/function';
import 'core-js/es6/parse-int';
import 'core-js/es6/parse-float';
import 'core-js/es6/number';
import 'core-js/es6/math';
import 'core-js/es6/string';
import 'core-js/es6/date';
import 'core-js/es6/array';
import 'core-js/es6/regexp';
import 'core-js/es6/map';
import 'core-js/es6/weak-map';
import 'core-js/es6/set';
/** The following are needed for NgClass support on SVG elements in IE10 and IE11 */
import 'classlist.js'; // Execute npm install --save classlist.js
.
/** The Reflect API needs these for IE10 and IE11 */
import 'core-js/es6/reflect';
/** Evergreen browsers require the below polyfills. **/
// Required for reflect-metadata in JIT. If exclusively using Angular decorators with AOT, this can be excluded.
import 'core-js/es7/reflect';
/**
Web Animations
@angular/platform-browser/animations
Necessary only if AnimationBuilder is utilized within the app and targeting IE/Edge or Safari.
Standard animation support in Angular does not mandate any polyfills (as of Angular 6.0).
**/
import 'web-animations-js'; // Execute
npm install --save web-animations-js
.
/**
By default, zone.js will patch all possible macroTask and DomEvents
User can disable parts of macroTask/DomEvents patch by setting the following flags
*/
(window as any).__Zone_disable_requestAnimationFrame = true; // Disables patch requestAnimationFrame
(window as any).__Zone_disable_on_property = true; // Disables patch onProperty like onclick
(window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // Disables patching specified eventNames
/*
In IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
With the flag below, it bypasses zone.js
patch for IE/Edge
*/
(window as any).__Zone_enable_cross_context_check = true;
/***************************************************************************************************
import 'zone.js/dist/zone'; // Part of Angular CLI.
/***************************************************************************************************
// Adds global to window, assigning the value of window itself.
(window as any)['global'] = window;
If (!Element.prototype.matches) {
Element.prototype.matches = (<any>Element.prototype).msMatchesSelector ||
Element.prototype.webkitMatchesSelector;
}
package.json
{
"name": "xtreme-admin-angular",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "node app.js",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"postinstall": "node patch-webpack.js"
},
"private": true,
"dependencies": {
"@agm/core": "^1.0.0-beta.7",
"@angular/animations": "^7.0.1",
"@angular/common": "^7.0.1",
"@angular/compiler": "^7.0.1",
...
},
"devDependencies": {
"@angular-builders/custom-webpack": "^8.2.0",
"@angular-devkit/build-angular": "^0.10.7",
...
},
"browser": {
"crypto": false,
"stream": false
}
}