can't get angular app to shrink the vendor.js size

Discussão em 'Angular' iniciado por wil, Janeiro 10, 2025.

  1. wil

    wil Guest

    I am running linux in AWS and can't seem to figure out if it is running development configuration or the production configuration. I am using Angular 13 (still)

    My configuration looks like this.

    "configurations": {
    "production": {
    "aot": true,
    "optimization": true,
    "buildOptimizer": true,
    "sourceMap": false,
    "outputHashing": "all",
    "namedChunks": false,
    "vendorChunk": false,
    "budgets": [
    {
    "type": "initial",
    "maximumWarning": "2mb",
    "maximumError": "7mb"
    },
    {
    "type": "anyComponentStyle",
    "maximumWarning": "175kb",
    "maximumError": "190kb"
    }
    ],
    "fileReplacements": [
    {
    "replace": "src/environments/environment.ts",
    "with": "src/environments/environment.prod.ts"
    }
    ]
    },
    "development": {
    "buildOptimizer": false,
    "optimization": false,
    "vendorChunk": true,
    "extractLicenses": false,
    "sourceMap": true,
    "namedChunks": true
    }
    },
    "defaultConfiguration": "production"
    },


    my afterinstall script to build angular in Linux box in AWS is

    ./node_modules/.bin/ng build --configuration production >> ngbuildlog.txt


    but it seems to run development configuration instead. I think this because optimization is not working, it doesn't shrink the vendor.js size. My vendor.js file is 10 mb. when I test it locally using development with "optimization": true and "buildOptimizer": true. It will shrink it to 2mb. Any ideas?

    Continue reading...

Compartilhe esta Página