如何修复 Angular 和 flag-icons:Two output files share the same path but have different contents: media/...svg
问题
你在 Angular 应用中使用 flag-icons 包,使用 ng build 或 ng serve 构建应用时出现以下错误:
解决方案
这仅影响开发构建,因为开发构建默认只有 outputHashing: "none"。
因此,在 angular.json 中的开发构建选项中添加 outputHashing: "media"。如果你想哈希所有文件,也可以设置 outputHashing: "all",但我建议开发构建使用 outputHashing: "media"。
这是你的 development 构建选项应该看起来的样子:
不要忘记在旧行末尾添加逗号。
原始来源:flag-icons 的 GitHub 问题跟踪器
Check out similar posts by category:
Angular
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow