-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Please add Ahead of time compile support #758
Comments
Wow, it's really silly that ahead of time compilation doesn't work with default exports. Is it enough to add a named export in addition to the default one? |
@stubailo i think it would work, this is what I also did first. but I wouldn't recommend it. If any library or code imports the default export it would still brake on AOT. At least that's what happened to me (if I interpreted the errors correctly). |
That just seems offensive - you can't use AOT in your app if any code in any dependency uses a default import? I absolutely do not think that's a reasonable restriction for a build tool to impose on the user. Is there a relevant issue somewhere I can comment on? |
don't take my word on it, i'm not very deep into this whole topic. but it somehow makes sense that you can't analyze the code statically if exports are not named. its also possible that this only applies to stuff you include into your root module. the place to discuss this would probably be at the compiler[-cli] repo of angular. |
Rollup definitely does nice static analysis with default exports. I'd admit that it might be harder but it sure isn't impossible, and a tool like this IMO has the responsibility to work with standard language features. I'll take a look there. |
They're going to support it angular/angular#11402 |
currently apollo-client breaks the compilation with the angular compiler "ngc". As far as i could see the main problem would be that ApolloClient is a default export which breaks static analyzation. See this helpful post for details: https://medium.com/@isaacplmann/making-your-angular-2-library-statically-analyzable-for-aot-e1c6f3ebedd5#.pbg52i3qt
I made quick fix to a copy of the apolloclient-source in my project in this regard which seemed to work. I also includes some "hacks" to remove circular dependencies to make the library compatible with rollup. Seeing that you do a refactor right now i think its no use to create a proper pull request for that? Otherwise just ask.
The text was updated successfully, but these errors were encountered: