I'm using the angular cli config fileReplacements
in angular.json file to replace a folder content, like this:
{
"projects": {
"myProject": {
"architect": {
"build": {
"configurations": {
"prod": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
},
{
"replace": "node_modules/moment/locale/",
"with": "src/moment-js-locale/"
}
]
}
}
}
}
}
}
}
Notice that in replace
value I'm using a path to a folder instead of a path to a file.
This is working code for Angular 10.
I upgraded to Angular 11 and now I'm getting an error when trying to build a prod version using this command:
ng build --prod
The error I'm getting is:
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.
ESLint is showing me this warning:
String does not match the pattern of "\.(([cm]?j|t)sx?|json)$".
What can I do with this? Is this an Angular 11 bug? should I use a different approach?
Any help will be appreciated.