Skip to content

Angular.json File replacement not working for index.html file #10992

@ghost

Description

I'm submitting a...


[X] Bug report  

Current behavior

In angular.json build.configuration.fileReplacement does not replace index.html with index.prod.html

Expected behavior

Should replace index.html with index.prod.html similar to how it replaces environment.ts with environment.prod.ts

Minimal reproduction of the problem with instructions

1. Create a new index.prod.html in same directory as original.
2. Update angular.json to replace the original index.html with the new index.prod.html

"configurations": {
                        "production": {
                            "optimization": true,
                            "outputHashing": "all",
                            "sourceMap": false,
                            "extractCss": true,
                            "namedChunks": false,
                            "aot": true,
                            "extractLicenses": true,
                            "vendorChunk": false,
                            "buildOptimizer": true,
                            "fileReplacements": [
                                {
                                    "replace": "src/environments/environment.ts",
                                    "with": "src/environments/environment.prod.ts"
                                },
                                {
                                    "replace": "src/index.html",
                                    "with": "src/index.prod.html"
                                }
                            ]
                        },

What is the motivation / use case for changing the behavior?

Environment

Angular CLI: 6.0.0
Node: 9.8.0
OS: darwin x64
Angular: 6.0.0
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, http, language-service, material, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.0
@angular-devkit/build-angular     0.6.0
@angular-devkit/build-optimizer   0.6.0
@angular-devkit/core              0.6.0
@angular-devkit/schematics        0.6.0 (cli-only)
@angular/flex-layout              6.0.0-beta.15
@ngtools/webpack                  6.0.0
@schematics/angular               0.6.0 (cli-only)
@schematics/update                0.6.0
rxjs                              6.1.0
typescript                        2.7.2
webpack                           4.6.0

Browser:

  • Chrome (desktop) version XX

For Tooling issues:

  • Node version: v9.8.0
  • Platform: Mac

Others:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions