Тёмный
No video :(

Angular dev build vs prod build 

kudvenkat
Подписаться 832 тыс.
Просмотров 51 тыс.
50% 1

In this video we will discuss the differences between a development build and a production build in angular.
Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our RU-vid channel. Hope you can help.
/ @aarvikitchen5572
To generate a development build we can use either
ng build
OR
ng build --dev
To generate a production build we use
ng build --prod
Here are some of the differences between a development build and a production build in angular.
Source Maps : Development build generate Source Maps where as production build does not.
What are Source Maps
To improve the performance, the application's JavaScript and CSS files are combined and compressed. It is extremely difficult to debug those compressed files. A source map holds information about the original files and can be used to map the code within a compressed file back to it’s original position in a source file. So with the help of these source maps we can easily debug our applications even after the the files are compressed and combined.
By default, a development build produce source maps where as a production build does not. However, we can change this default behaviour by using --sourcemaps option along with the ng build command. It's alias is -sm.
The following command produces a development build without source maps as we have set -sm option to false
ng build --dev -sm false
On the other hand, if you want source maps along with your production build set -sm option to true as shown below.
ng build --prod -sm true
Extracts CSS : With the development build global styles are extracted to .js files where as with the production build they are extracted to .css files. To change this default behaviour use --extract-css option or it's alias -ec with the ng build command.
The following command produces a development build with global styles extracted to .css file(s) instead of .js ones.
ng build --dev -ec true
Minification & Uglification : A Prod Build is both minified and uglified, where as a Dev Build is not.
What is Minification
The process of removing excess whitespace, comments, and optional tokens like curly brackets and semicolons is called Minification.
What is Uglification
The process of transforming code to use short variable and function names is called uglification.
The minified and uglified version of the file is smaller in size than the full version, resulting in faster response times and lower bandwidth costs.
If you look at the bundles generated by the prod build, you will notice that they are minified and uglified. Notice, extra whitespaces, comments, and optional tokens like curly brackets and semicolons are removed. Also notice, the code is transformed by using short variable and function names. On the other hand, the bundles generated by the dev build, are not minified and uglified.
Tree Shaking : A Prod build is Tree Shaked, where as a Dev build is not.
What is Tree Shaking
Tree shaking is the process of removing any code that we are not actually using in our application from the final bundle. It's one of the most effective techniques to reduce the application size.
If you look at the bundles generated by the production build, they are significantly less in size compared with the bundles generated by the development build. This is beacause with the production build the code is tree shaked to remove dead code i.e the code that is not referenced by the application.
Ahead-of-Time (AOT) Compilation : With a production build we get AOT (Ahead-of-Time) compilation, i.e the Angular component templates are pre-compiled, where as with a development build they are not. We will discuss Ahead-of-Time compilation in detail in our next video.
The following table summarises the differences between a development build and a production build
Feature Development Build Production Build
Source Maps Yes No
Extracts CSS .js file .css file
Minifaction No Yes
Uglification No Yes
Tree Shaking No Yes
AOT No Yes
Text version of the video
csharp-video-tu...
Slides
csharp-video-tu...
Angular CLI Tutorial
• What is Angular CLI
Angular CLI Text articles & Slides
csharp-video-tu...
All Dot Net and SQL Server Tutorials in English
www.youtube.co...
All Dot Net and SQL Server Tutorials in Arabic
/ kudvenkatarabic

Опубликовано:

 

27 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 25   
@iliyasmohammed6192
@iliyasmohammed6192 5 лет назад
Very clearly explained about the differences between dev build and prod build. Thanks
@harishkumarsrigiri
@harishkumarsrigiri 6 лет назад
Wow! very clearly explained about the differences between dev build and prod build
@beltek01
@beltek01 2 года назад
One of the very best explanations i have found for this topic..Thanks a ton
@sharkkrish
@sharkkrish 3 года назад
Super presentation
@kerahari
@kerahari 6 лет назад
Nice content , good explanation with proper examples.
@wagnerdossantos466
@wagnerdossantos466 5 лет назад
This video deserve a dev ops course in Udemy! Very great!
@luckylikey9280
@luckylikey9280 5 лет назад
hmm it seems like this doesn't fit to CLI version 6.2.5 anymore. I can still use --prod, but --dev and -sm is not recognized
@jimmybellmon6730
@jimmybellmon6730 6 лет назад
is there any way get a log/list of files that were "tree shaken"? so I would know what components of files I were not using?
@80amnesia
@80amnesia 6 лет назад
Thanks Venkat!
@workspace5052
@workspace5052 3 года назад
Sir well done what a explanation.
@abhinaw1232
@abhinaw1232 6 лет назад
Hello Sir, Ultimate videos. Please put some light on build tools like webpack,gulp and grunt with differences.
@kavinkumar
@kavinkumar 5 лет назад
Hi All, When I generate package using ng prod,minified files are generated like *.bundle.js but I want it to be *.bundle.min.js, can you please help me to achieve it.
@themynamesb
@themynamesb 4 года назад
Nice video
@vikasbotre687
@vikasbotre687 6 лет назад
Hi Sir, Can you provide the suggestion for this issue , ERROR in : Illegal state: Could not load the summary for directive RouterOutlet in H:/angularfive/myfirstapp/node_modules/@angular/Router/router.d.ts.
@renatolins9812
@renatolins9812 6 лет назад
Nice video, you are awesome!
@himanshuupreti9457
@himanshuupreti9457 5 лет назад
What are the long digits means : Ex :vendor.8484848849392929228.bundle.js etc..
@nys8260
@nys8260 3 года назад
2021: you can found vendor.js content for produciton build in main.js instead of ng build -sm false go to angular.json and set sourceMap to true
@zhgaaaaaan
@zhgaaaaaan 6 лет назад
can u provide ionic fretwork tutorial ?
@Dev.Aditii
@Dev.Aditii 4 года назад
Amma Jio
@cloudusakash5915
@cloudusakash5915 6 лет назад
how to compress vendor bundle file in dist folder
@tender.branson
@tender.branson 6 лет назад
It's compressed automatically when you run ng build command with --prod or -p option.
@cloudusakash5915
@cloudusakash5915 6 лет назад
yes, but i have run this command but vendor bundle size is 7 mb...
@daviddonadze221
@daviddonadze221 3 года назад
omg thank you so much
@sashidhar2285
@sashidhar2285 4 года назад
alias are not working
@Dev.Aditii
@Dev.Aditii 4 года назад
Hawtmaka
Далее
Angular aot vs jit
9:41
Просмотров 60 тыс.
Angular cli generate component
12:07
Просмотров 61 тыс.
나랑 아빠가 아이스크림 먹을 때
00:15
Просмотров 2 млн
ПОЁМ НАРОДНЫЕ ПЕСНИ🪗
2:04:11
Просмотров 1,1 млн
Local Storage & Session Storage [ with Code Examples ]
14:52
What’s new in Angular v18
20:08
Просмотров 118 тыс.
Angular Routing
17:54
Просмотров 41 тыс.
Deploying Angular Applications | Mosh
27:07
Просмотров 126 тыс.
Observable retry on error
13:22
Просмотров 65 тыс.
Angular CLI project structure   1
7:21
Просмотров 49 тыс.
Angular tslint rules
8:30
Просмотров 30 тыс.
나랑 아빠가 아이스크림 먹을 때
00:15
Просмотров 2 млн