code-chunks / angular2-logger

A log4j inspired logger for angular 2.
MIT License
144 stars 41 forks source link

Angular 6: Runtime error while running prod build #180

Closed ramandeep-singh-1983 closed 6 years ago

ramandeep-singh-1983 commented 6 years ago

I just migrated my project from Angular 5 to Angular 6. It works fine in development build but gives the following error in web browser console in production mode:

Uncaught TypeError: Cannot read property 'WARN' of undefined at Object.GRNk (logger.js:16) at c (bootstrap:81) at Object.tlJs (core.js:7) at c (bootstrap:81) at Object.AytR (environment.ts:21) at c (bootstrap:81) at Object.zUnb (data-grid.js:1168) at c (bootstrap:81) at Object.5 (pager.js:562) at c (bootstrap:81)

This is the culprit line in node_modules/angular2-logger/app/core/logger.js:

level: level_1.Level.WARN,

Edit: It's apparently an issue with angular-devkit/build-optimizer version 0.6.0. I downgraded to 0.5.13 and the issue was gone.