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
AOT Fail #127
Comments
@MurhafSousli — Are you importing the rxjs operators in your library code?
|
@jvandemo I already have these imports in the library.
I think there is an issue with rollup and @Injectable()
export class NgProgressBrowserXhr extends BrowserXhr {
private currentRequest: number = 0;
constructor(private service: NgProgressService) {
super();
}
public build() {
const xhr = super.build();
.....
}
} |
@MurhafSousli — Is it possible to share your code? Thanks! |
The gulp file has two rollup modes/tasks (umd and fesm), did you put the same externals in both modes ? |
This fixed it for me... I was having the same problem... I also noticed some WARNINGS when building (see #149). I had no idea what to do so I tried fixing those warnings first, I read somewhere that I should try exporting every component, model, service, etc that is being used by the module and its components in Anyway, fixing those warnings also fixed Hope this helps! |
@sebastianteres probably do you refer to export all lambdas ? https://medium.com/@isaacplmann/making-your-angular-2-library-statically-analyzable-for-aot-e1c6f3ebedd5 |
@MurhafSousli Can you please apply @sebastianteres's recommendations and see if that works for you? Thanks! |
@diego-d5000 I finally found the reference! It was buried in my search history from yesterday 😄 To give you an example: My library has 3 components:
<p>Component Foo!</p>
<p>Component Bar!</p>
<foo></foo>
<bar></bar> Library module exports component Component FooBar So my export * from './my-module';
export * from './foo-bar/foo-bar.component'; I believe this will cause the Warnings mentioned in #149 and #126. So to fix it you would have to edit export * from './my-module';
export * from './foo/foo.component';
export * from './bar/bar.component';
export * from './foo-bar/foo-bar.component'; To be honest I didn't know if this was necessary to begin with but I assumed I could only export what I wanted the library users to use and not to have to export everything. In this case I think is a valid scenario to only want to export fooBar and not foo or bar individually. To be even more honest I'm not sure what I should be exporting or if I could leave anything out from Be that as it may, this fixed both the Warnings and the Runtime error for me. |
@sebastianteres — Thank you so much for sharing, much appreciated! 👍 |
Hi, I've got the same problem. When using inheritance inside my library. For example I have a BaseComponent all other components like for example EmailComponent inherits from it. When I dont use inheritance (which leads to a lot of boilerplate code :() the warnings in the console are gone. Any idea on how to fix this? update ok I was able to supress the warnings in the console by adding this to the gulpfile (rollup task)
now when I building and running my main application with AOT the following error is thrown
|
Just posted the same issue here: I followed the steps from the docs, I didn't change a word.... |
I use couple of RXJS operators, I have added them in
gulpfile.js
gulp build output:
I don't understand why I am getting these errors!
Now when I import the dist package in a new app, I get no errors while compiling, but it is broken at runtime, getting these errors:
The text was updated successfully, but these errors were encountered: