From 9e5d4781cb1712c78899449738eb309b902c6d25 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Tue, 21 Mar 2017 08:27:18 -0700 Subject: [PATCH] refactor(aio): cleanup polyfill imports and realign them with the latest cli blueprint This shouldn't change anything. But it's interesting that we used to have this import that seemed bogus, but there were no compilation or rutime errors. --- aio/src/main.ts | 8 +++--- aio/src/polyfills.ts | 64 ++++++++++++++++++++++++++++++++------------ aio/src/test.ts | 1 - 3 files changed, 50 insertions(+), 23 deletions(-) diff --git a/aio/src/main.ts b/aio/src/main.ts index a59cc3382d..a9ca1caf8c 100644 --- a/aio/src/main.ts +++ b/aio/src/main.ts @@ -1,10 +1,8 @@ -import 'core-js/es7/reflect'; -import 'zone.js/dist/zone'; - -import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { enableProdMode } from '@angular/core'; -import { environment } from './environments/environment'; +import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; + import { AppModule } from './app/app.module'; +import { environment } from './environments/environment'; if (environment.production) { enableProdMode(); diff --git a/aio/src/polyfills.ts b/aio/src/polyfills.ts index 4a9f6bbcfd..53bdaf1b86 100644 --- a/aio/src/polyfills.ts +++ b/aio/src/polyfills.ts @@ -1,7 +1,24 @@ +/** + * This file includes polyfills needed by Angular and is loaded before the app. + * You can add your own extra polyfills to this file. + * + * This file is divided into 2 sections: + * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. + * 2. Application imports. Files imported after ZoneJS that should be loaded before your main + * file. + * + * The current setup is for so-called "evergreen" browsers; the last versions of browsers that + * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), + * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. + * + * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html + */ +/*************************************************************************************************** + * BROWSER POLYFILLS + */ -// This file includes polyfills needed by Angular and is loaded before the app. -// You can add your own extra polyfills to this file. +/** IE9, IE10 and IE11 requires all of the following polyfills. **/ // import 'core-js/es6/symbol'; // import 'core-js/es6/object'; // import 'core-js/es6/function'; @@ -15,24 +32,37 @@ // import 'core-js/es6/regexp'; // import 'core-js/es6/map'; // import 'core-js/es6/set'; -import 'reflect-metadata'; + +/** IE10 and IE11 requires the following for NgClass support on SVG elements */ +// import 'classlist.js'; // Run `npm install --save classlist.js`. + +/** IE10 and IE11 requires the following to support `@angular/animation`. */ +// import 'web-animations-js'; // Run `npm install --save web-animations-js`. -// If you need to support the browsers/features below, uncomment the import -// and run `npm install import-name-here'; -// Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html +/** Evergreen browsers require these. **/ +import 'core-js/es6/reflect'; +import 'core-js/es7/reflect'; -// Needed for: IE9 -// import 'classlist.js'; -// Animations -// Needed for: All but Chrome and Firefox, Not supported in IE9 -// import 'web-animations-js'; +/** ALL Firefox browsers require the following to support `@angular/animation`. **/ +// import 'web-animations-js'; // Run `npm install --save web-animations-js`. -// Date, currency, decimal and percent pipes -// Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10 -// import 'intl'; -// NgClass on SVG elements -// Needed for: IE10, IE11 -// import 'classlist.js'; + +/*************************************************************************************************** + * Zone JS is required by Angular itself. + */ +import 'zone.js/dist/zone'; // Included with Angular CLI. + + + +/*************************************************************************************************** + * APPLICATION IMPORTS + */ + +/** + * Date, currency, decimal and percent pipes. + * Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10 + */ +// import 'intl'; // Run `npm install --save intl`. diff --git a/aio/src/test.ts b/aio/src/test.ts index 7eef72157c..9bf72267e9 100644 --- a/aio/src/test.ts +++ b/aio/src/test.ts @@ -1,6 +1,5 @@ // This file is required by karma.conf.js and loads recursively all the .spec and framework files -import 'zone.js/dist/zone'; import 'zone.js/dist/long-stack-trace-zone'; import 'zone.js/dist/proxy.js'; import 'zone.js/dist/sync-test';