App goes very slow when "filereplacements" implementing in angular.json in angular ionic app

50 Views Asked by At

When I change the environments configuration in angular.json,

"customer1-dev": {
            "fileReplacements": [
                {
                    "replace": "src/environments/environment.ts",
                    "with": "src/environments/environment.customer1.ts"
                }
            ],
            "buildOptimizer": false,
            "optimization": false,
            "vendorChunk": true,
            "extractLicenses": false,
            "sourceMap": true,
            "namedChunks": true
            
        },

When I add 'fileReplacements' in the configuration, my app run very slow.

and when I remove the 'fileReplacements' then app run faster.

I had create a environment setup for the different-2 customer with the same app source-code. Reference URL That's why I need to setup configuration in angular.json.

Environment setup for customer specific, is working fine but app run very slow.

1

There are 1 best solutions below

2
Andrew Allen On

Typical development config:

{
    "configurations": {
        ...
        // can change "development" to any configuration target
        "development": {
          "buildOptimizer": false,
          "optimization": false,
          "vendorChunk": true,
          "extractLicenses": false,
          "sourceMap": true,
          "namedChunks": true,
          "fileReplacements": [...]
        }
}

By not optimising the dev server is faster. Obviously you'll need a separate production config to get an optimised build.