![](/img/trans.png)
[英]Angular Project fails compilation with @angular-builders/custom-webpack on scss files
[英]Pass custom environment parameters to @angular-builders/custom-webpack
在我們的 Angular 9 應用程序中,我們在 angular.json 中配置了多個環境。
我們還使用 @angular-builders/custom-webpack 添加一些自定義插件,這些插件需要一些基於環境的輸入變量,但是如果我向環境節點添加自定義屬性,我會收到此錯誤:
數據路徑“”不應具有其他屬性(customPluginConfigForSandboxEnvironment)
"architect": {
"build": {
"configurations": {
"sandbox": {
"outputPath": ....,
"customPluginConfigForSandboxEnvironment": {}
有可能做這樣的事情嗎?
在 customWebpackConfig 文件中,我可以從選項中讀取 outputPath
module.exports = (config, options) => {
並在這里保存我的額外配置,但如果可能的話,我更願意將所有配置保留在 angular.json 中。
謝謝
您可以使用兩個單獨的配置文件:
{
...
"projects": {
"your-app": {
...
"architect": {
"build": {
"builder": "@angular-builders/custom-webpack:browser",
"options": {
"customWebpackConfig": {
"mergeRules": {
"externals": "replace"
}
},
...
},
"configurations": {
"production": {
"customWebpackConfig": {
"path": "./webpack.config.prod.ts"
},
...
},
"development": {
"customWebpackConfig": {
"path": "./webpack.config.dev.ts"
}
}
},
...
}
}
}
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.