Question: Because of the way we are set up here, my local development environment (ng serve) is not the same as my production build environment( ng build --base-href="/path/" --prod. I'd like to use different index.html files for serve and build, with the build still generating the correct index.html.

If I change my angular.json, I get a message that property fileReplacements is not allowed. File replacement for ng serve seems simplest to maintain though.

```
"serve": {
  "configurations": {
    "production": {
      "fileReplacements": [
        {
          "replace": "src/environments/environment.ts",
          "with": "src/environments/environment.prod.ts"
        }
      ],
    }
  }
}

```

This gives me an error that the property fileReplacements is not allowed in the serve section. Package.json has @angular/core ^8.0 and angular cli ~8.0.2.

Whenever I search for a solution, my results point me to the fileReplacements documentation, but that doesn't seem to work. The file isn't getting replaced. I know there are tons of other ways to do this, but I'd like to do it the approved angular.json way if possible.

Answer: 
Finally got round to implementing this, thought i would post this incase anyone else runs into the same problem as this provides an alternative answer. Ended up opting to use the `--index` flag in angular.json config.

Only downside is that i had to specify the same name file, so `index.html` which meant a few extra folders to separate the files. 

File Structure 

```
index_files 
    > environment_1
        > index.html
    > environment_2
        > index.html

```

angular.json

```
"configurations": {
    "environment_1": {
        "index": "index_files/environment_1.index.html"
    },
   "environment_2": {
        "index": "index_files/environment_2.index.html"
    }
}

```
i developed the [NPM package](http://[Index%20file%20replacer][1]) that will copy index file from src folder replace in dist folder 

```
  "scripts":{ 
"build": "ng build && npm run-script copy-index-file",
"copy-index-file":"node node_modules/index-file-replacer/lib/ --index=index2.html"
 }

```

in this example index2.html is a file that will be copied to dist folder 

now run this command `npm run-script build` it will build project and copy the index file to dist folder