0

I'm using the Angluar CLI starter kit, And I'm having issues with the performance. It's impossible for me to work on my app with Firefox, so I have to work with Chrome (which eats lots of RAM). I was looking on the network traffic console of my chrome, and I saw these details:

387 request | 143 KB transferred | Finish: 5.38 s | DOMContentLoader: 575 ms | Load: 1.34s

This is so sick, I'm not surprised that my Firefox can't barely handle it. And I barely started to develop my App.

So, my questions are:

  • Is it normal?
  • Will it be like that when I'll set my app to production?
  • Is there any solution for this?

This is not a possible dublicate of Angular2 too many file requests on load because I'm using Angular CLI And it's much more different, I don't know even how can I combine Webpack with this framework.

Community
  • 1
  • 1
Eliya Cohen
  • 10,716
  • 13
  • 59
  • 116
  • Possible duplicate of [Angular2 too many file requests on load](http://stackoverflow.com/questions/35280582/angular2-too-many-file-requests-on-load) – eko Jun 23 '16 at 07:51

1 Answers1

1

This is the reason for 387 requests, in systemjs.config.js:

 // Individual files (~300 requests):
  function packIndex(pkgName) {
    packages['@angular/'+pkgName] = { main: 'index.js', defaultExtension: 'js' };
  }
  // Bundled (~40 requests):
  function packUmd(pkgName) {
    packages['@angular/'+pkgName] = { main: '/bundles/' + pkgName + '.umd.js', defaultExtension: 'js' };
  }
  // Most environments should use UMD; some (Karma) need the individual index files
  var setPackageConfig = System.packageWithIndex ? packIndex : packUmd;
  // Add package entries for angular packages

So you could reduce that to 40 requests if you set System.packageWithIndex = false:

   <script>
         System.packageWithIndex = false;
        System.import('./app/bootstrap').catch(console.log.bind(console));
    </script>
null canvas
  • 10,201
  • 2
  • 15
  • 18