angular2-logger icon indicating copy to clipboard operation
angular2-logger copied to clipboard

AoT v0.5.1 Module node_modules/angular2-logger/core has no exported member LOG_LOGGER_PROVIDERS

Open philjones88 opened this issue 9 years ago • 8 comments

AoT doesn't seem to like:

import { Logger, LOG_LOGGER_PROVIDERS } from 'angular2-logger/core';

Errors with:

Error at /Users/phil/Documents/Projects/aot/src/app/app.module.ngfactory.ts:281:39: Module '"/Users/phil/Documents/Projects/node_modules/angular2-logger/core"' has no exported member 'LOG_LOGGER_PROVIDERS'.
Error at /Users/phil/Documents/Projects/aot/src/app/app.module.ngfactory.ts:732:44: Module '"/Users/phil/Documents/Projects/node_modules/angular2-logger/core"' has no exported member 'LOG_LOGGER_PROVIDERS'.

Angular 2.3.1 Typescript 2.0.10

philjones88 avatar Dec 20 '16 13:12 philjones88

What is AoT?

langley-agm avatar Dec 20 '16 14:12 langley-agm

@langley-agm https://angular.io/docs/ts/latest/cookbook/aot-compiler.html

philjones88 avatar Dec 20 '16 14:12 philjones88

Maybe see also https://medium.com/@isaacplmann/making-your-angular-2-library-statically-analyzable-for-aot-e1c6f3ebedd5#.1vvjzjr22

philjones88 avatar Dec 20 '16 14:12 philjones88

Gotcha, do you mind sharing an example with your issue reproduceable?

langley-agm avatar Dec 20 '16 15:12 langley-agm

I've worked around it via:

import { Logger, Options, Level } from 'angular2-logger/core';

then inside my NgModule:

        Logger,
        { provide: Options, useValue: { level: Level.LOG } },

basically, manually doing what the LOG_LOGGER_PROVIDERS does

philjones88 avatar Dec 21 '16 14:12 philjones88

Looks like https://github.com/Stabzs/Angular2-Toaster just went 2.0.0 and is now fully AoT and UMD. Might be an idea to borrow how they have done things :)

philjones88 avatar Dec 22 '16 09:12 philjones88

I'm getting a related error trying to build an AoT optimized app:

build prod failed: Error encountered resolving symbol values statically. Only initialized variables and constants can be referenced because the value of this variable is needed by the template compiler (position 47:14 in the original .ts file), resolving symbol DEBUG_LOGGER_PROVIDERS in /node_modules/angular2-logger/core.d.ts

I'm new to AoT, but here are some AoT Do's and Don'ts: https://github.com/rangle/angular-2-aot-sandbox#aot-dos-and-donts

Doing what Phil did above bypassed the issue!

vkniazeu avatar Mar 18 '17 18:03 vkniazeu

@vkniazeu Thanks for the feedback, I'm working on this issue atm, trying to find a way for both configurations to work.

langley-agm avatar Mar 19 '17 01:03 langley-agm