Reputation: 57
I have problem with long loading angular 2 app, it takes almost 8 seconds. I noticed that the most time takes loading rxjs. There are tens of requests to rxjs/observable rxjs/add rxjs/operator
What can i do to improve my app loading?
Upvotes: 0
Views: 127
Reputation: 125
If you are using systemjs as module loader.
Including bundled versions, angular related modules comes with umd bundles.
Part of systemjs.config.js
:
var umdPackages = [
"@angular/common",
"@angular/compiler",
"@angular/core",
"@angular/http",
"@angular/platform-browser",
"@angular/platform-browser-dynamic",
"@angular/router",
"@angular/testing"
];
umdPackages.forEach(function(name) {
var main = name.slice(name.lastIndexOf("/") + 1) + ".umd.js";
packages[name] = { main: main, format: "amd", defaultExtension: "js"};
});
It will reduce requests by ~300.
umd
and system.register
. But it doesn't work, loading still happens one by one file (for rxjs) - isFunction.js
, Observer.js
, etc.Upvotes: 1