Skip to content

Suggestion to use Closure Compiler for Ahead of Time Compilation #2981

Closed

Description

@naveedahmed1

Suggestion to use Closure Compiler for Ahead of Time Compilation after generating ngfactory files.

OS?
Windows 10

Versions
angular-cli: 1.0.0-beta.19
node: 6.9.1

I am sure Angular CLI team is working hard on the features like AoT with support for Lazy Loading.

While you finalize this feature, I wanted to suggest you to use Closure Compiler after generating ngfactory files using ngc, because it seems to be the only tool that would transpile the ES2015 Rollup Bundle to ES5 with 100% reliability.

While compiling large projects with ngc (after generating ngfactory), it returns Heep Errors. Please have a look at:

angular/angular#12184

I came across this repository, https://github.com/steveblue/angular2-rollup and in Production notes it explains why Closure Compile is a better option. Please have a look at:

https://github.com/steveblue/angular2-rollup#production

When using Angular CLI in my current project:

If I use lazy loading and build with --prod --aot, it just generate main bundle and when I run it returns missing module error.

If I remove lazyloading and build with --prod --aot, its returns same heep error which I mentioned above.

Activity

  1. Meligy commented on Nov 6, 2016

    @Meligy
    Contributor

    +1 recorded above.

    Some related discussion from the Angular repo angular/angular#8550

  2. ivaylopivanov commented on Mar 6, 2017

    @ivaylopivanov

    @filipesilva is there a short or long term plan to support closure's advanced optimization?

  3. filipesilva commented on Mar 6, 2017

    @filipesilva
    Contributor

    We've been looking at ways we can add it but so far there isn't any viable solution.

  4. Meligy commented on Mar 7, 2017

    @Meligy
    Contributor

    If you are interested in following the progress, better subscribe to the Closure support issue in Angular itself (angular/angular#8550).
    I suppose nothing can happen here before that is closed and released.

  5. JohannesRudolph commented on Mar 25, 2017

    @JohannesRudolph
    Contributor

    4.0 just announced experimental support for closure compiler for the framework itself I suppose...

  6. naveedahmed1 commented on Mar 25, 2017

    @naveedahmed1
    Author

    Yes, here are the details, http://angularjs.blogspot.com/2017/03/angular-400-now-available.html .

    But it says that "All of our code now has Closure annotations" are they referring to the angular code or the code aot compiler generates. Does it mean that our custom components, directives etc should also have closure Annotations? and same goes for the angular plugins as well?

  7. steveblue commented on Apr 6, 2017

    @steveblue

    The only reason I refuse to use the CLI for Enterprise projects is because it does not support ClosureCompiler. During ng-conf it was announced that internal teams at Google validate the latest versions of Angular and these teams are using ClosureCompiler. I would feel way more comfortable using a similar build process that replicates how teams at Google bundle Angular web apps. Webpack may be the popular option, but there could be smaller bundles produced through other methods and more optimal code splitting. The core team is already experimenting with going straight from AOT => ClosureCompiler (https://github.com/alexeagle/closure-compiler-angular-bundling). It would be nice if the CLI would support this and Code Splitting.

  8. elvisbegovic commented on Apr 28, 2017

    @elvisbegovic
    Contributor

    hope we can see this one day in cli, actually bundle i know there is gzip but even

  9. saulshanabrook commented on Jun 28, 2017

    @saulshanabrook

    It seems like it is working not with rxjs https://github.com/angular/closure-demo

  10. steveblue commented on Jun 28, 2017

    @steveblue

    There is limited support for ngc => ClosureCompiler and third party libraries ATM but that will change over time. Use "externs" to support third party libraries.

  11. aldo-roman commented on Sep 24, 2017

    @aldo-roman

    Hi everyone, any updates on this?

    angular/angular#8550 was closed early this year.

    I see all the demo repos but they use ngc directly, and not angular-cli. Is there a way to include closure compiler on the building pipe?

    Cheers!

  12. buu700 commented on Oct 6, 2017

    @buu700
    Contributor

    +1 on the request for updates. After all the work that went into Closure support and fanfare around it during the 4.0 release, I was surprised to see The Past, Present, and Future of the Angular CLI not even acknowledge this.

    Edit: angular/angular#19058

  13. hansl commented on Feb 20, 2018

    @hansl
    Contributor

    We're reworking the entire build chain, so closing this.

  14. steve-todorov commented on Feb 20, 2018

    @steve-todorov

    @hansl could you give us some related issues to the refactoring the team is working on? I've been following this for a while and would like to see where it goes. :)

  15. naveedahmed1 commented on Aug 31, 2019

    @naveedahmed1
    Author

    Any update on this?

  16. angular-automatic-lock-bot commented on Oct 1, 2019

    @angular-automatic-lock-bot

    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.

  17. locked and limited conversation to collaborators on Oct 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions