Reputation: 93
How to reduce production build size.
production build : ng build --prod
angular.json config file:
main.js(4.3mB) has pdf.js(303kB), pdf_viewer.js(100kB) apart from these a seperate pdf.worker.js(739kB) is also present.
cpexcel.js and xlsx.js are taking more space.
i never used jszip present in xlsx
Iam using ng2-pdf-viewer to work with pdf files.
Dev build: ng build
here main.js(1.2mb) does not contain pdf.js(303kB), pdf_viewer.js(100kB). These are included in vendor.js.
But has pdfworker.js of size 1.51mB
Thanks
Upvotes: 2
Views: 392
Reputation: 1261
I've had similar issu, for my solution: You can intall custom-webpack to your devDependencies
Read their doc to see how to use this package, there is my confituration extrat-webpack.config.js
of to remove cpexcel and jszip
module.exports = {
resolve: {
alias: {
"./dist/cpexcel.js": "",
"./jszip.js": ""
}
},
};
By the way, I'm using angular 9
and "@angular-builders/custom-webpack": "^10.0.0",
Upvotes: 1