#StackBounty: #angular Angular budgets throw error but files do not reach size

Bounty: 50

In my Angular 8’s angular.json file I have set an initial budget for production:

"production": {
    "optimization": true,
    "outputHashing": "all",
    "sourceMap": false,
    "extractCss": true,
    "namedChunks": false,
    "aot": true,
    "extractLicenses": true,
    "vendorChunk": true,
    "buildOptimizer": true,
    "fileReplacements": [{
        "replace": "src/environments/environment.ts",
        "with": "src/environments/environment.prod.ts"
    "budgets": [{
        "type": "initial",
        "maximumWarning": "1.5mb",
        "maximumError": "1.6mb"
    "serviceWorker": true

When I run ng build --prod the output errors:

Console output

However, none of the files tagged as initial have reached mentioned file size, neither alone nor together:

enter image description here

What is happening? Why is this error being thrown?

Note 1: Files get generated after removing budgets and running exactly same command, otherwise they don’t get generated.

Note 2: Files generated seem to be duplicate, but that is Angular 8’s differential loading (es5/es2015).

Note 3: Files generated don’t even match in size with console output.

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.