2

I am working on reducing load time of my angular 4 app. My app has 16 JSON files (only 47.1 kb in size), these files are the service response mocks and are for developer use only. This means, in case the service is down the developer can use these mock JSON responses and continue to develop code on their local code setup.

My question is can these JSON files increase the response time of my website? As of now these JSON files are not being called ever in the production. So, if I remove them will my websites's response time increase?

Anna
  • 1,669
  • 7
  • 38
  • 63
  • I would say, it depends on the size of `json` files. If it is very less, than you won't see any difference. Huge `json` file size would make a difference in load time. – Amit Chigadani Aug 23 '18 at 09:28
  • @AmitChigadani the files size is only 47.1 kb. – Anna Aug 23 '18 at 09:55
  • Ok, that would probably again reduce after doing production build. So that will hardly make a difference to your load time. – Amit Chigadani Aug 23 '18 at 09:59
  • @AmitChigadani why do you say that the file size will again reduce after doing production build? Please explain, this is new for me. – Anna Aug 23 '18 at 10:11
  • See here https://angular.io/guide/deployment#optimize-for-production to know what all happens, when you do production build – Amit Chigadani Aug 23 '18 at 10:20

1 Answers1

0

Best to remove them for a prod build. Will prob not effect load time of a route but may have a minor impact on the bundle size if they are included, which will prob have a very minor impact on the initial load time. Either way, its best to remove them for a prod build, you wouldn't want to accidentally mock data in prod and if they aren't there that's never gonna happen.

danday74
  • 52,471
  • 49
  • 232
  • 283