gothinkster / angular-realworld-example-app

Exemplary real world application built with Angular
MIT License
5.27k stars 3.18k forks source link

Use Production Build in Demo Mode #92

Closed GulajavaMinistudio closed 6 years ago

GulajavaMinistudio commented 6 years ago

I checking Angular Realworld Demo, but after i check in Inspect Element in Network Tab , this demo is not using production mode or production build. And the result is not fast as production mode.

Try run Production Build with this command ng build --prod --build-optimizer

Docs https://angular.io/guide/deployment

manishjanky commented 6 years ago

This will really impact the metrics as. In production mode with aot angular compiler is not loaded in the browser and compilation is done at build time. Thus reducing the chunk size as well as improves the performance as the compilation is not happening in the browser which is the case with the current build of this application.

juristr commented 6 years ago

The production build is already made. What the current scripts don't do is to run the build optimizer.

https://github.com/gothinkster/angular-realworld-example-app/blob/master/package.json#L8

@GulajavaMinistudio could you test this out locally and in case submit a PR?

Toxicable commented 6 years ago

Build optimizer is enabled by default on the current version of the cli

manishjanky commented 6 years ago

@juristr build optimizer does not need any setup its part of angular-cli you just need to add a script

'prod': 'ng build --prod --build-optimizer'

and use this script to create the production build.

--build-optimizer is just a flag that tells the cli to use aot build and optimize it for production.

juristr commented 6 years ago

@manishjanky Sure.

@Toxicable In fact I recall to have seen that somewhere in the changelog. Starting from which version of the CLI is that the case?

Toxicable commented 6 years ago

@juristr Im not sure on that one, Might have been around 1.5 or 1.6 at a guess.

Toxicable commented 6 years ago

closed via 399804ae6f34b52dbe6eb097009f29641e538ef4

GulajavaMinistudio commented 6 years ago

Many thanks for response :)