-
Notifications
You must be signed in to change notification settings - Fork 26.2k
InjectorError trying to inject Injector into AOT-compiled library when using JIT for app #20102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hmm, that's weird.
Could you explain what you mean by this? angular-cli is only used in the app, the lib uses plain ngc. |
Angular CLI will remove |
Ah, I think now I understand what you did. |
Oh, I see, then your problem should be lacking of Your lib would importing a different Angular library, meaning you'll have two sets of Angular framework in your app. But it won't affect the real use case (normal npm install). |
Ok, that seems to have solved it. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
I'm submitting a...
Current behavior
A library with a directive that requires injection of
Injector
is AOT-compiled and distributed with metadata.An app imports the library's module and applies the directive to an element.
Running the app with
ng serve --aot
works fine, theInjector
is injected into the library directive.Running the app with
ng serve
(JIT) results in error on page load:Note that this is not specific to
Injector
, trying to inject e.g.IterableDiffers
causes the same problem.Expected behavior
The app works with both JIT and AOT.
Minimal reproduction of the problem with instructions
https://github.com/jeysal/ng5-jit-inj-repro
Follow the instructions in the readme on
master
to reproduce.Branch
master
contains the library (with very basic build setup).Branch
app
contains the app (generated by angular-cli).Environment
The text was updated successfully, but these errors were encountered: