angularwebpackmanifest

Swamping manifest file based on environment in deployment


I would like to deploy a different manifest file to our staging and production environment. I wonder about using fileReplacement in Angular.json like this:

 "configurations": {
        "production": {
          "fileReplacements": [
            {
              "replace": "apps/store/src/manifest.webmanifest",
              "with": "apps/store/src/manifests/manifest.prod.webmanifest"
            }
          ],
         ....
      }

Is this possible? if not, how can I do that?

Thanks.


Solution

  • As far as nobody finds a proper answer to my question. I like to share my workaround:

    Use NPM Scripts:

    Package.json:

    "manifest:prod": "cp ./apps/store/src/manifests/manifest.prod.webmanifest ./apps/store/src/manifest.webmanifest",
    

    In Gitlab Ci:

     script:
        - npm install -g @angular/cli
        - npm install
        - npm run manifest:prod