3

I created a new project using angular cli 16.1.1 to test the new CSP styling nonce injection feature. I am able to serve the application ng serve and adding the header to both the <app-root and CSP header works correctly, but with the ngCspNonce value set, I am unable to build using ng build.

I get the following error:

ng build
✔ Browser application bundle generation complete.
✔ Copying assets complete.
✖ Index html generation failed.
link.prev?.setAttribute is not a function

Please confirm if I am only supposed to add this field after the build has completed, when injecting the nonce value while serving the website, or if there is some other error here.

Angular CLI: 16.1.1
Node: 16.14.2
Package Manager: npm 8.5.0
OS: win32 x64

Angular: 16.1.2
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1601.1
@angular-devkit/build-angular   16.1.1
@angular-devkit/core            16.1.1
@angular-devkit/schematics      16.1.1
@angular/cli                    16.1.1
@schematics/angular             16.1.1
rxjs                            7.8.1
typescript                      5.1.3

I have tried changing the string of ngCspNonce, but that makes no difference.

0 Answers0