Angular-cli: More production-ready production build

Created on 2 Jun 2016  路  7Comments  路  Source: angular/angular-cli

Feature request: that the production build option produce output that follows many fairly easy "best practices":

  • Concatenate all of the polyfills together, into a file named with a hash of the contents. Every round-trip counts.
  • Ship the application plus the tree shaken libraries in another JS file (already working) again named based on a hash of the contents.
  • Assume that those JS asset files will be permacached - hence the need to name them with a hash, because once a file is shipped it can never be changed under a permacache scheme.
  • Inject the name of these two JavaScript files into the index, rather than the considerably more than 2 we get today even with the -prod option.
  • If the poly-fill file isn't very large, consider combining it with the application and libraries to one JS file total. It is a competitive world, and the other folks can ship their whole thing with a single round trip, we can too.
  • Generate .gz pre-gzipped files also.
  • Offer an option that omits the main libraries (Angular!) from its own output and instead references a well-known CDN - this is sometimes a better approach for widely web deployed software, even though it loses the tree shaking. It would be slick to have this as a simple option while building instead of something to configure oneself.

Something generally like the above (details vary expert by expert) would be a solid baseline for every Angular developer to have immediately available in the CLI. A high percentage of Angular projects may then need no build tooling at all beyond the CLI.

(Something I would love to see, but it's probably a crazy amount of scope: automatically use "universal" to generate HTML for the first screen, then "CSS shake" to get the minimum CSS for this first screen, and include both of the above directly in the HTML, therefore providing a very high score for "Google page speed" for Angular apps managed using the CLI. This would be bliss. I am just dreaming, not requesting this feature...)

feature

Most helpful comment

" into a file named with a hash of the contents." This feature is important!

All 7 comments

I'm not personally ready to work on this right now, nor able to say what is going to happen from that list, but think it's a good list to start with to guide feature design.

The CDN option and multiple files won't be an issue for me if the CLI adds automatic support for Service Workers, plus a way to customize it with extra code.

I'm also worried about minifying images (png, jpg, svg, etc).

I really want to use it but I didn't migrate completely to Angular 2, and my current build project is based on old yeoman angular generator with lots of tiny refactors... :P

" into a file named with a hash of the contents." This feature is important!

A lot of these points were introduced in #1455.

Once I try out the new stuff, I'll post a comment with a new, shorter list!

Heya, I'm closing this issue as obsolete since some of these items have been addressed so far and others are not feasible anymore or we don't plan to add them (like optional CDN).

Please open individual issues for specific requests that you'd still like to see in the CLI.

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._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hareeshav picture hareeshav  路  3Comments

gotschmarcel picture gotschmarcel  路  3Comments

purushottamjha picture purushottamjha  路  3Comments

sysmat picture sysmat  路  3Comments

brtnshrdr picture brtnshrdr  路  3Comments