Skip to content
This repository was archived by the owner on Dec 18, 2024. It is now read-only.

Commit 17428e8

Browse files
devversionSplaktar
authored andcommitted
build: fix angular cli commonjs warnings for polyfills
The polyfills file was incorrectly imported through the `main` file of the CLI project. This caused undesired CommonJS dependency warnings for ZoneJS. We fix this by removing the import of the polyfills and letting the CLI handle the polyfills as normally done in fresh CLI projects. Also disables the zone-error import from the devmode environment. ZoneJS generally has the potential of hiding errors (as seen with the `Object.defineProperty` patch that was enabled by default in non-evergreen Zone bundles), so we should disable it. It seems better aligning devmode as much as possible with prodmode to catch issues more quickly. Debugging without `zone-error` is not any different from common Angular/ZoneJS errors as seen in the components or framework repositories.
1 parent b04ce82 commit 17428e8

File tree

4 files changed

+2
-5
lines changed

4 files changed

+2
-5
lines changed

angular.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"sourceMap": true,
2121
"outputPath": "dist/material-angular-io",
2222
"index": "src/index.html",
23+
"polyfills": "src/polyfills.ts",
2324
"main": "src/main.ts",
2425
"tsConfig": "tsconfig.app.json",
2526
"assets": [

src/assets/stack-blitz/src/main.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import './polyfills';
2-
31
import {HttpClientModule} from '@angular/common/http';
42
import {NgModule} from '@angular/core';
53
import {FormsModule, ReactiveFormsModule} from '@angular/forms';

src/environments/environment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ export const environment = {
1616
* This import should be commented out in production mode because it will have a negative impact
1717
* on performance if an error is thrown.
1818
*/
19-
import 'zone.js/fesm2015/zone-error'; // Included with Angular CLI.
19+
// import 'zone.js/fesm2015/zone-error'; // Included with Angular CLI.

src/main.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import './polyfills.ts';
2-
31
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
42
import {enableProdMode} from '@angular/core';
53
import {environment} from './environments/environment';

0 commit comments

Comments
 (0)