最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

angularjs - Angular v9 subresource-integrity flag not adding integrity - Stack Overflow

programmeradmin5浏览0评论

I am working on an Angular 9 application and attempting to use the subresource integrity flag when building with ng build but I am not seeing any integrity properties added in the generated index.html page. Unfortunately I cannot add any of the code as it is a work project

We are specifically using Angular v9.1.13 and angular CLI v9.1.15. I have tried building with

ng build --subresource-integrity

ng build --subresource-integrity true

ng build --subresource-integrity=true

ng build --subresource-integrity --prod

ng build --subresource-integrity --configuration=dev

and every time when I check the generated index file the only integrity attributes I am seeing are the ones previously added manually. Even when deleting some of the manually added ones and rebuilding I am not seeing them being added either. I have also added subresourceIntegrity: true into all of the build configurations in the angular.json file but this also does not seem to have any effect, and I updated the package.json build script to include --subresource-integrity and had no luck with it either

From my understanding subresource-integrity has been in Angular CLI since v1.something so v9 should be just fine, and Angular v9 should also be recent enough to handle it, so I can not seem to figure out why I am not seeing integrity tags. I have deleted the dist folder and rebuilt at least a dozen times today but to no avail.

I have already looked at and attempted the answers from the below questions and neither are working.

Subresource Integrity With Angular-Cli How to add subresources integrity with Angular appShell build

EDIT I still cannot seem to find much in the way of actual documentation regarding this flag but based off of what little I can find, and some extrapolation from various local tests, it seems as if the --subresource-integrity flag and updates to build configurations do NOT apply to any external dependencies added directly to the index.html file, only ones from package.json. If anyone can confirm or deny this it would be appreciated

发布评论

评论列表(0)

  1. 暂无评论