File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 2626 // The nonce is passed to the client through the HTML to avoid sync issues between tabs
2727 source = source .Replace (" **PLACEHOLDER_NONCE_SERVER**" , nonce );
2828
29- var nonceScript = $" <script nonce=\" {nonce }\" src=" ;
30- source = source .Replace (" <script src=" , nonceScript );
29+ if (hostEnvironment .IsDevelopment ())
30+ {
31+ // do nothing in development, Angular > 18.1.0 adds the nonce automatically
32+ }
33+ else
34+ {
35+ // Angular release build does not add any nonce to the scripts, so we need to add it manually
36+ var nonceScript = $" <script nonce=\" {nonce }\" " ;
37+ source = source .Replace (" <script " , nonceScript );
38+ }
3139
3240 // link rel="stylesheet"
3341 var nonceLinkStyle = $" <link nonce=\" {nonce }\" rel=\" stylesheet\" " ;
You can’t perform that action at this time.
0 commit comments