ALopez
ALopez

Reputation: 131

How to add preserveSymlinks Angular build option based on enviroment

How can I set a build option, preserveSymlinks in angular.json based on the environment? I mean if the environment is prod the option must be true, if not it must be false.

Upvotes: 1

Views: 3852

Answers (1)

Maihan Nijat
Maihan Nijat

Reputation: 9355

The Angular.json has the configuration for production to set preserveSymlinks:

"configurations": {
    "production": {
        "fileReplacements": [ {
            "replace": "src/environments/environment.ts", "with": "src/environments/environment.prod.ts"
        }
        ],
        "optimization": true,
        "outputHashing": "all",
        "sourceMap": false,
        "extractCss": true,
        "namedChunks": false,
        "aot": true,
        "preserveSymlinks": true,
        "extractLicenses": true,
        "vendorChunk": false,
        "buildOptimizer": true,
        "budgets": [ {
            "type": "initial", "maximumWarning": "2mb", "maximumError": "5mb"
        }
        ]
    }
} 

By default preserveSymlinks is false. You don't need to put it for dev environment.

Upvotes: 1

Related Questions