What are some reasons why you would want to start a project with Angular 2+ as opposed to React or Vue?
I'm asking because I remember the overhead for Angular being significantly more than Vue and React in production. Is this tradeoff worth it? Why?
Top comments (6)
First off, I want to dispel the myth the overhead is significantly more for Angular. Angular apps can be highly optimized with lazy loading and even a single bundle can optimized incredibly well with Terser or Closure Compiler. The Angular team is working hard to implement a new compiler called IVY in Angular 9 that will be backwards compatible, but also optimizes even better than the current compiler.
A 'Hello World' app with Angular 7 is ~30Kb and that will be significantly reduced with the new IVY compiler. The key metric to look at however is how gracefully does an app built with Angular scale. I can tell you after working on over a dozen Angular apps, I have never observed another framework scale as gracefully in practice. I have seen bloated Angular apps that do not preform well, but that isn’t the fault of the framework. Bad software development practice leads to significant overhead.
Here are some benefits of going with Angular
One other thing.
Here is the output from the latest version of the CLI after running ng build --prod.
Even the polyfills file is more than your 30Kb target. How do I optimize this app to the target?
You have to serve the app with gzip or brotli compression to see the most optimal result. The compiled code is highly gzippable.
This is what I'm looking for. Thanks for your answer.
I'd say the main reason I choose angular over the other frameworks is the opinionated nature of the framework itself. I find it much easier to learn the "right" way to do things within the angular framework. Once you have learned the "right" way, you will rarely have to update that understanding. If you need to implement something it's usually fairly trivial to find an existing open source angular project that has implemented something similar. The opinionated nature of the framework means it's pretty easy to plug and play that code into whatever you are building. As far as I'm concerned bundle sizes are no longer an issue in angular applications.
If opinionated is the maIn reason for choosing Angular, Ember would be a much better option. Also, they don't have many breaking changes and if they do, they roll out in a much better and systematic manner in my opinion