Skip to content
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

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

Closed
naveedahmed1 opened this issue Nov 2, 2016 · 16 comments
Closed

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

naveedahmed1 opened this issue Nov 2, 2016 · 16 comments

Comments

@naveedahmed1
Copy link

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.

@Meligy
Copy link
Contributor

Meligy commented Nov 6, 2016

+1 recorded above.

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

@ivaylopivanov
Copy link

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

@filipesilva
Copy link
Contributor

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

@Meligy
Copy link
Contributor

Meligy commented Mar 7, 2017

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.

@JohannesRudolph
Copy link
Contributor

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

@naveedahmed1
Copy link
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?

@steveblue
Copy link

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.

@elvisbegovic
Copy link
Contributor

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

@saulshanabrook
Copy link

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

@steveblue
Copy link

steveblue commented Jun 28, 2017

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.

@aldo-roman
Copy link

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!

@buu700
Copy link
Contributor

buu700 commented Oct 6, 2017

+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

@hansl
Copy link
Contributor

hansl commented Feb 20, 2018

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

@hansl hansl closed this as completed Feb 20, 2018
@steve-todorov
Copy link

@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. :)

@naveedahmed1
Copy link
Author

Any update on this?

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Oct 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests