- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 angular cli 配置 fileReplacements
在 angular.json 文件中替换文件夹内容,如下所示:
{
"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/"
}
]
}
}
}
}
}
}
}
请注意,在
replace
value 我使用的是文件夹的路径而不是文件的路径。
ng build --prod
我得到的错误是:
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 向我展示了这个警告:
String does not match the pattern of "\.(([cm]?j|t)sx?|json)$".
我能用这个做什么?这是 Angular 11 的错误吗?我应该使用不同的方法吗?
最佳答案
所以事实证明这个功能实际上是一个 Bug 🙂
从一开始就不应该在 Angular 10 之前进行文件夹替换这一事实。
我在 angular-cli repo 中问过这个问题这是我得到的答案:
I am sorry that you are experiencing this issue after updating. However, replacing directories was never a supported use-case of the file replacements feature.
shell
命令,我正在使用
npm run script
将此脚本作为预构建脚本运行.
关于angular - 无法设置 fileReplacements 以使用 Angular 11 替换文件夹内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65280076/
我们目前正在将项目从 Angular 8 升级到 10,并且在构建过程中遇到了文件替换问题。我们有 2 种不同的样式和不同的文本,过去通过在配置中执行 FileReplacements 来选择它们。
我有一堆 Angular 配置,我将它们相互结合使用以构建不同的版本,但我遇到的一个问题是配置的 fileReplacements 属性未合并,并且给出了最后一个配置在构建命令中覆盖配置属性的其余部分
我正在使用 angular cli 配置 fileReplacements在 angular.json 文件中替换文件夹内容,如下所示: { "projects": { "myProjec
我是一名优秀的程序员,十分优秀!