From d3927bfe2b953d07fc675d6323da7955f94e52ba Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Fri, 12 May 2017 18:57:05 +0100 Subject: [PATCH] feat(@angular/cli): load reflect only on dev `reflect-metadata` is not needed in AOT builds. --- .../ng/files/__path__/environments/environment.ts | 5 +++++ .../@angular/cli/blueprints/ng/files/__path__/polyfills.ts | 7 +++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/@angular/cli/blueprints/ng/files/__path__/environments/environment.ts b/packages/@angular/cli/blueprints/ng/files/__path__/environments/environment.ts index b7f639aecac5..50f1de4d6acc 100644 --- a/packages/@angular/cli/blueprints/ng/files/__path__/environments/environment.ts +++ b/packages/@angular/cli/blueprints/ng/files/__path__/environments/environment.ts @@ -3,6 +3,11 @@ // `ng build --env=prod` then `environment.prod.ts` will be used instead. // The list of which env maps to which file can be found in `.angular-cli.json`. +// Evergreen browsers require these polyfills on non-aot builds. +// If you need to use `--prod --no-aot` you should transfer these over to `polyfills.ts`. +import 'core-js/es6/reflect'; +import 'core-js/es7/reflect'; + export const environment = { production: false }; diff --git a/packages/@angular/cli/blueprints/ng/files/__path__/polyfills.ts b/packages/@angular/cli/blueprints/ng/files/__path__/polyfills.ts index 7831e97b79a4..dd1f0dfc2960 100644 --- a/packages/@angular/cli/blueprints/ng/files/__path__/polyfills.ts +++ b/packages/@angular/cli/blueprints/ng/files/__path__/polyfills.ts @@ -37,10 +37,6 @@ /** IE10 and IE11 requires the following for NgClass support on SVG elements */ // import 'classlist.js'; // Run `npm install --save classlist.js`. -/** Evergreen browsers require these. **/ -import 'core-js/es6/reflect'; -import 'core-js/es7/reflect'; - /** * Required to support Web Animations `@angular/animation`. @@ -70,3 +66,6 @@ import 'zone.js/dist/zone'; // Included with Angular CLI. * Need to import at least one locale-data with intl. */ // import 'intl/locale-data/jsonp/en'; + +// Each environment can have different polyfills as well. +import './environments/environment';