Very Slow Loading (Angular 4)

Asked

Viewed 1,766 times

2

I put an application in Angular 4.3 in production and realize that the first load is quite slow for the application size (2.93 Mb)

The site does not connect to API Rest at the moment, it is only the visual part.

I took a look at the Chrome development tool and realized that the file that takes the longest to load is the vendor. I also noticed that he is not able to read fonts with extension . woff2.

Does anyone have any idea what’s causing it and how to solve it?

link: https://www.tecnologiainfo.com.br/sgba/

  • here opened normal, what the vendor time for you, here gave 118ms

  • Here was 9.3s. The internet apparently is at good speed. Strange!

2 answers

1

Good morning Duilio, as you are generating your versions in production.

Is using ng build --prod ??

If that’s not the problem.

If so, how was your application built? Are you using the "Lazy loading" concept?? If not take a look at this video https://www.youtube.com/watch?v=glOJxHDkdnQ&t=492s.

I hope I’ve helped.

  • Good morning Eduardo, thank you for the answer! I used ng build --Prod yes! I have not yet applied Lazt loading, even because there are few components being loaded. More relevant only the components of Primeng. Did you test the load there? It took a long time? However I still find it strange it takes almost 10s to load a 2.93mb file. Anyway I will apply Lazy loading to see if it improves significantly.

  • Duilio, I use Lazy loading in my project, gives a very big difference.

1

The main problem was that it was carrying modules unnecessarily, especially those coming from Primeng. I fixed the imports and activated the Gzip compression on the server, improved considerably.

I will add the Lazy Loading strategy as well and should improve even more.

I appreciate your help!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.