therightdoctors
therightdoctors

Reputation: 548

how to reduce main.*.js file after build of angular 7 project?

After building angular 7 project our main.*.js file size is 8.8 mb. We are already using gzip compression.Can you suggest how can we reduce its size so that it doesn't take more time to load?

Upvotes: 0

Views: 966

Answers (2)

BLAYTI Ribh
BLAYTI Ribh

Reputation: 71

build with aot mode:ng build --aot

or

ng build --prod

more in cli docs

see also the new Angular engine (in recent versions): ivy

Upvotes: 1

Muhammed Albarmavi
Muhammed Albarmavi

Reputation: 24404

you need to divide you components to modules then use module lazy loading this will take these component source to single module and loaded separably from main.*.js

Upvotes: 1

Related Questions