I recently upgraded my Angular application to version 11.
After running > ng build --prod
I received the following output:
√ Browser application bundle generation complete.
√ ES5 bundle generation complete.
Initial Chunk Files | Names | Size
scripts.3cf268d47c462590e7d9.js | scripts | 3.27 MB
main-es5.9973d9ddec6de2b044ba.js | main | 2.49 MB
main-es2015.9973d9ddec6de2b044ba.js | main | 2.36 MB
styles.d540d930321db4c962dc.css | styles | 245.64 kB
polyfills-es5.259ae27e17f48bc03647.js | polyfills-es5 | 131.80 kB
polyfills-es2015.732b81c0b5a3e3dbb1bc.js | polyfills | 36.16 kB
runtime-es2015.a4dadbc03350107420a4.js | runtime | 1.45 kB
runtime-es5.a4dadbc03350107420a4.js | runtime | 1.45 kB
| Initial ES5 Total | 6.13 MB
| Initial ES2015 Total | 5.91 MB
Build at: 2021-02-18T14:49:39.581Z - Hash: 0e159b0e28a5a4f69881 - Time: 144004ms
However, I encountered an error:
Error: bundle initial-es5 exceeded maximum budget. Budget 6.00 MB was not met by 133.51 kB with a total of 6.13 MB.
Although I have previously adjusted the budget size:
"budgets": [
{
"type": "initial",
"maximumWarning": "4mb",
"maximumError": "6mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb",
"maximumError": "10kb"
}
]
Increasing the budget again is possible, but not ideal.
Here is my package.json file for reference:
{
"name": "dashboard-frontend",
"version": "0.0.0",
"sideEffects": false,
// Remaining content of the package.json file
Any suggestions on how to reduce the size of the dist folder?
Thank you