StaticInjectorError(AppModule)[FlexDirective -> MediaMonitor] on serve --aot
Bug
I created a component library that use FlexLayout. I package this library using ng-packagr, and then include it in other projects in order to easily reuse components.
When I run "ng serve --aot" in the application that use my library, I have the following error: Uncaught (in promise): Error: StaticInjectorError(AppModule)[FlexDirective -> MediaMonitor]
What is the expected behavior?
No errors :)
What is the current behavior?
No problem with "ng serve", but if I run "ng serve --aot", and use a component of my library that use FlexLayout, I have the following stacktrace:
ERROR Error: StaticInjectorError(AppModule)[FlexDirective -> MediaMonitor]: StaticInjectorError(Platform: core)[FlexDirective -> MediaMonitor]: NullInjectorError: No provider for MediaMonitor! at NullInjector.get (core.js:1002) at resolveToken (core.js:1300) at tryResolveToken (core.js:1242) at StaticInjector.get (core.js:1110) at resolveToken (core.js:1300) at tryResolveToken (core.js:1242) at StaticInjector.get (core.js:1110) at resolveNgModuleDep (core.js:10850) at NgModuleRef.get (core.js:12083) at resolveDep (core.js:12573)
What are the steps to reproduce?
Hard to reproduce. You have to create a project with a component that use FlexLayout, then build it with ng-packagr and use it in another app.
What is the use-case or motivation for changing an existing behavior?
Obvious :)
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Windows 10, Chrome latest "@angular/cdk": "^5.2.1", "@angular/material": "^5.2.1", "typescript": "~2.5.3"
Is there anything else we should know?
I have try to dig this issue as mush as I could, but I admit I'm a bit lost :)
same issue here @tanou73 how did you solve it? I downgraded to v2.0.0-beta12 that seems to work fine
I solved it for some time now, but I think that I ended up adding flex-layout as externals in the ng-packager.json and list it in the peer-dependencies
@tanou73 Can you provide a link to a minimal reproduction?
Since it’s been a few months and no demo has been provided, I’m closing this issue. If a demo is provided we can reopen it.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.