Reputation: 1030
In the above picture its clear that My application is taking too much time(3 mins as shown in the image) to load for the first time. I am not able to find the actual reason.
Some details about my application:
If any further details is needed I ll provide , Please help me out in finding the actual reason behind the delay.
Upvotes: 1
Views: 1832
Reputation:
It can be 13 components with 6K lines of code. Number of components don't matter, code complexity does.
Lazy loading doesn't reduce the bundle size : lazy loading is the features that loads the Javascript when asked instead of when received
spec
files don't appear in the build, and .scss
files are compiled into JS (making no difference in the final build, whether you use inline styling or URL styling)
See point n° 1
Again, similar to point n° 1, it depends on the commands you run and the code you need to compile.
I can't see images, but have you ran a lighthouse audit on your application ? It might tell you what you can improve.
Upvotes: 2
Reputation: 50291
Take the advantage of angular router and module lazy loading. For example create module of relevant component and when the vie is visited load the specific js file
In the example when customer
route is visited it will load the relevant js file so is other module
const routes: Routes = [
{
path: 'customers',
loadChildren: './customers/customers.module#CustomersModule'
},
{
path: 'orders',
loadChildren: './orders/orders.module#OrdersModule'
}
];
Also you can run ng build --prod
. This will compress the code, will eliminate dead code
Upvotes: 2