Skip to content

angular.json fileReplacements no longer accept folder path replacements in Angular 11 #19621

@benshabatnoam

Description

@benshabatnoam

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

Yes, the previous version in which this bug was not present was: 10.0.1

Description

I'm using fileReplacements config in order to replace an entire folder content. This used to work well using v10.0.1
In version 11.0.3 it isn't working anymore. It will give me the following lint warning:
String does not match the pattern of "\.(([cm]?j|t)sx?|json)$".

And when trying to build a prod version it is giving the following error:

Schema validation failed with the following errors:
  Data path ".fileReplacements[1]" should NOT have additional properties(replace).
  Data path ".fileReplacements[1].replace" should match pattern "\.(([cm]?j|t)sx?|json)$".
  Data path ".fileReplacements[1]" should match exactly one schema in oneOf.

🔬 Minimal Reproduction

  1. Add a path to folder in replace and with configs like this:
"configurations": {
  "prod": {
    "fileReplacements": [
      {
        "replace": "node_modules/moment/locale/",
        "with": "src/moment-js-locale/"
      }
    ],
  }
}
  1. run command
    ng build --prod

🔥 Exception or Error


 lint warning:
String does not match the pattern of "\.(([cm]?j|t)sx?|json)$".

build error:
Schema validation failed with the following errors:
  Data path ".fileReplacements[1]" should NOT have additional properties(replace).
  Data path ".fileReplacements[1].replace" should match pattern "\.(([cm]?j|t)sx?|json)$".
  Data path ".fileReplacements[1]" should match exactly one schema in oneOf.

🌍 Your Environment


Angular CLI: 11.0.3
Node: 14.3.0
OS: win32 x64

Angular: 11.0.4
... common, compiler, compiler-cli, core, language-service
... localize, platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1100.3
@angular-devkit/build-angular   0.1100.3
@angular-devkit/core            11.0.3
@angular-devkit/schematics      11.0.3
@angular/cli                    11.0.3
@schematics/angular             11.0.3
@schematics/update              0.1100.3
rxjs                            6.6.0
typescript                      4.0.5

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