0

I'm writing a test with AngularJS 2, then i look at the "Network" section of the Developer Tools and I see : 35 requests.

RXJS only: 20 requests.

Since the browsers have a limited amount of connections, the page loads in 400ms, even if it's little-sized files.

In this test, i just have:

  • main.ts
  • app.component.ts
  • index.html

I don't have another component.

What I would like to do is lower the 35 requests. Theorically, i should have 4 requests: index.html, angular2.js, main.js and app.component.js .

Is it even possible or AngularJS 2 is built in a way there will always have lots of little requests ?

EDIT: I'm using gulp to launch tsc.

1 Answers1

1

I was facing the same problem or i can say everyone must be facing the same problem but i got a solution for this and its working cool ....

the number of requests can be handled with the use of gulp or webpack , for tha you just check this out

https://www.youtube.com/watch?v=j9w5hFit5rM

it helped me and i'm sure it will help evryone for this issue :)

Akshay Rao
  • 3,454
  • 1
  • 15
  • 19
  • I edited my post, i'm currently using gulp. I won't use webpack, i saw the video, i need a solution for gulp. Thanks for the help :) – Pierre Emmanuel Lallemant Jul 17 '16 at 16:49
  • i am using webpack but still i have read about this article ... http://blog.scottlogic.com/2015/12/24/creating-an-angular-2-build.html ... You can check this out for gulp or u can see this which i have got right now ...http://stackoverflow.com/questions/35280582/angular2-too-many-file-requests-on-load i hope this will give u what u are looking for :) – Akshay Rao Jul 17 '16 at 16:55
  • http://stackoverflow.com/questions/35280582/angular2-too-many-file-requests-on-load response n°2 answers to my problem. Thanks ! – Pierre Emmanuel Lallemant Jul 17 '16 at 18:23