Subresource Integrity With Angular-Cli
E

2

9

I was wondering if anyone knew of a possible way to activate Subresource Integrety with Angular-Cli. According to the following link: GitHub Pull Request It would be a feature (or a future feature). I was hoping to activate it but it does not seem to be active on the current versions. Is there another way to use Subresource Integrety with Angular-Cli?

Exceptive answered 17/7, 2017 at 6:47 Comment(0)
N
12

Pass the --subresource-integrity flag into your ng build command.

You can verify that it works by looking at your index.html file. You'll see the integrity attribute on linked stylesheets and scripts.

SRI requires v1.5.0+ of the CLI.

E.G. ng build --subresource-integrity

Neoptolemus answered 26/1, 2018 at 0:15 Comment(4)
Unfortunately I won't be able to test this soon so if anyone has success with this solution please let me know so I can mark this as the answer :).Exceptive
--subresource-integrity flag is only available for the build command, not serveMelanymelaphyre
I feel like it used to work on a serve command. Maybe it did when I wrote the answer. But when I try it now the CLI puts a note in the console that it ignores that SRI flag. I'll update the answer accordingly.Neoptolemus
That is true for just about everything in the modern web. If possible, I recommending encouraging your customers, users, and/or management to stop using or supporting IE. (Good luck.)Neoptolemus
D
1

Now we can simply add "subresourceIntegrity": true in production configurations in angular.json file

Dioptase answered 20/3 at 8:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.