Skip to content

Commit 6015f71

Browse files
authored
Blazor ext in service worker assets manifest (#18241)
1 parent 9a58f2e commit 6015f71

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

aspnetcore/host-and-deploy/blazor/webassembly.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Learn how to host and deploy a Blazor app using ASP.NET Core, Conte
55
monikerRange: '>= aspnetcore-3.1'
66
ms.author: riande
77
ms.custom: mvc
8-
ms.date: 05/07/2020
8+
ms.date: 05/19/2020
99
no-loc: [Blazor, "Identity", "Let's Encrypt", Razor, SignalR]
1010
uid: host-and-deploy/blazor/webassembly
1111
---
@@ -416,12 +416,24 @@ dir .\_framework\_bin | rename-item -NewName { $_.name -replace ".dll\b",".bin"
416416
((Get-Content .\_framework\blazor.boot.json -Raw) -replace '.dll"','.bin"') | Set-Content .\_framework\blazor.boot.json
417417
```
418418

419+
If service worker assets are also in use, add the following command:
420+
421+
```powershell
422+
((Get-Content .\service-worker-assets.js -Raw) -replace '.dll"','.bin"') | Set-Content .\service-worker-assets.js
423+
```
424+
419425
On Linux or macOS:
420426

421427
```console
422428
for f in _framework/_bin/*; do mv "$f" "`echo $f | sed -e 's/\.dll\b/.bin/g'`"; done
423429
sed -i 's/\.dll"/.bin"/g' _framework/blazor.boot.json
424430
```
431+
432+
If service worker assets are also in use, add the following command:
433+
434+
```console
435+
sed -i 's/\.dll"/.bin"/g' service-worker-assets.js
436+
```
425437

426438
To use a different file extension than *.bin*, replace *.bin* in the preceding commands.
427439

@@ -430,6 +442,8 @@ To address the compressed *blazor.boot.json.gz* and *blazor.boot.json.br* files,
430442
* Remove the compressed *blazor.boot.json.gz* and *blazor.boot.json.br* files. Compression is disabled with this approach.
431443
* Recompress the updated *blazor.boot.json* file.
432444

445+
The preceding guidance also applies when service worker assets are in use. Remove or recompress *wwwroot/service-worker-assets.js.br* and *wwwroot/service-worker-assets.js.gz*. Otherwise, file integrity checks fail in the browser.
446+
433447
The following Windows example uses a PowerShell script placed at the root of the project.
434448

435449
*ChangeDLLExtensions.ps1:*:
@@ -441,6 +455,12 @@ dir $filepath\bin\Release\$tfm\wwwroot\_framework\_bin | rename-item -NewName {
441455
Remove-Item $filepath\bin\Release\$tfm\wwwroot\_framework\blazor.boot.json.gz
442456
```
443457

458+
If service worker assets are also in use, add the following command:
459+
460+
```powershell
461+
((Get-Content $filepath\bin\Release\$tfm\wwwroot\service-worker-assets.js -Raw) -replace '.dll"','.bin"') | Set-Content $filepath\bin\Release\$tfm\wwwroot\service-worker-assets.js
462+
```
463+
444464
In the project file, the script is run after publishing the app:
445465

446466
```xml

0 commit comments

Comments
 (0)