darekf77 / ng2-logger

Isomorphic logger for Browser and NodeJS, ( typescript / javascript ) apps
MIT License
61 stars 17 forks source link

Log levels are optimized away in ng6 build #44

Closed CarstenLeue closed 5 years ago

CarstenLeue commented 6 years ago

I noticed that when using this library in an Angular 6 project, this code:

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Level;
(function (Level) {
    Level[Level["DATA"] = 0] = "DATA";
    Level[Level["INFO"] = 1] = "INFO";
    Level[Level["WARN"] = 2] = "WARN";
    Level[Level["ERROR"] = 3] = "ERROR";
    Level[Level["__NOTHING"] = 4] = "__NOTHING";
})(Level = exports.Level || (exports.Level = {}));
//# sourceMappingURL=level.js.map

is NOT part of my application bundle, the optimizer seems to remove it as a side effect (https://github.com/webpack/webpack/tree/master/examples/side-effects).

Would it be possible to provide a side effects free bundle (see webpack v4 "sideEffects": false in webpack https://goo.gl/jB3GVv).

It might be as simple as recompiling the bundle with ng-packagr using the latest libraries.

darekf77 commented 5 years ago

@CarstenLeue is this still as issue ?

darekf77 commented 5 years ago

on angular 7 everything works smooth...

CarstenLeue commented 5 years ago

looks good, thanks