我正在开发一个使用 jhipster、Spring Boot 和 Angular 设置的应用程序
我需要为某些东西设置不同的公钥,具体取决于应用程序是在 dev 还是 prod 上运行。
我已经在我的 angular.json 中坐了很长一段时间了,在谷歌上搜索了一堆解决方案,尝试了所有基于 angular.json 的解决方案。
这是我在 angular.json 中尝试过的:
我的三个索引文件都在 webapp 目录中。
angular.json(相关位):
"root": "",
"sourceRoot": "src/main/webapp",
"projectType": "application",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"index": "src/main/webapp/index.html",
"configurations": {
"production": {
"index": {
"input": "src/main/webapp/index-prod.html",
"output": "src/main/webapp/index.html"
}
}
},
"scripts": [
],
"styles": [
"./src/main/webapp/teststyle.css"
]
}
}
}
Run Code Online (Sandbox Code Playgroud)
该项目没有 environment.ts 文件,但 enableProdMode() 正在被调用(通过 webpack magic)并按预期运行。
我能做什么?理想情况下,我们希望不必在环境之间重建,但在这一点上,只要 index.html 文件自动更改,我就会使用它。