Reputation: 1438
I have created Angular Application in single module fully, after final deploy files are more than 8 Mb so for First time loading time is too slow,
i have tried with --prod now the file size is around 5MB
is there any other possible to speed up
Upvotes: 9
Views: 28097
Reputation: 2078
There are lots of action you can perform to improve performance and reduce the initial load of the application.
To improve runtime performance:
To learn more, make a prod build serve the application, open google chrome dev tools, last tab AUDIT, perform a google lighthouse test. It will suggest what can be done to improve the performance of the application.
Upvotes: 27
Reputation: 323
If you are using node js as a intermediate server just add this.
const express = require('express');
const path = require('path');
const compression = require('compression')
const app = express();
app.use(compression())
By this way you enableTextCompression
I have reduced the time half by using this.
Upvotes: 0
Reputation: 783
Always use latest versions of angular. Do code splitting. Lazy loading the modules reduces your initial bundle size. Remove unused imports. Try to avoid bloated third party libraries. Proper segregation of functionalities into separate modules.
Advanced: AFter doing all of the above, if you still want to reduce your bundle size. Try Using bazel for build process. https://blog.mgechev.com/2018/11/19/introduction-bazel-typescript-tutorial/
More Advanced: Still you want to reduce your bundle size. Wait for Angular Ivy(public release).
Upvotes: 1
Reputation: 1867
Since you already used --prod mode, next best options that i know are :
Upvotes: 11