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: 
I solved it using the --index flag for ng build, without using different folders by doing the following:

dev file

```
src/index-dev.html

```

production file

```
src/index.html

```

angular.json

```
"architect": {
    "build": {
      "builder": "@angular-devkit/build-angular:browser",
      "options": {
        "aot": true,
        "outputPath": "www",
        "index": "src/index-dev.html",
     }

```

cmd : 

```
ng build --prod --index=/src/index.html

```

For some reason --index only accepts index.html and no other filename in this solution.
If you want to use the different index file, we can use in doing that in single file, set a variable in different variables to assign a boolean value or other value and use ngIf for the content in the index file to switch for one to another. I have not done this code but it should work.