Skip to content

Commit c25a017

Browse files
committed
Update
1 parent 0fbb86b commit c25a017

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

server/Pages/_Host.cshtml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,8 @@
2929
if (hostEnvironment.IsDevelopment())
3030
{
3131
// 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);
32+
var viteScriptToUpdate = """<script type="module" src="/@vite/client"></script>""";
33+
source = source.Replace(viteScriptToUpdate, $"""<script type="module" src="/@vite/client" nonce="{nonce}"></script>""");
3834
}
3935

4036
// link rel="stylesheet"

0 commit comments

Comments
 (0)