Skip to content

Commit cc0bb57

Browse files
committed
Fix merge issue
1 parent c1dff4d commit cc0bb57

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Blazor.start({
2+
loadBootResource: function (type, name, defaultUri, integrity) {
3+
// For framework resources, use the precompressed .br files for faster downloads
4+
// This is needed only because GitHub pages doesn't natively support Brotli (or even gzip for .dll files)
5+
if (type !== 'dotnetjs' && location.hostname !== 'localhost') {
6+
return (async function () {
7+
const response = await fetch(defaultUri + '.br', { cache: 'no-cache' });
8+
if (!response.ok) {
9+
throw new Error(response.statusText);
10+
}
11+
const originalResponseBuffer = await response.arrayBuffer();
12+
const originalResponseArray = new Int8Array(originalResponseBuffer);
13+
const decompressedResponseArray = BrotliDecode(originalResponseArray);
14+
const contentType = type === 'dotnetwasm' ? 'application/wasm' : 'application/octet-stream';
15+
return new Response(decompressedResponseArray, { headers: { 'content-type': contentType } });
16+
})();
17+
}
18+
}
19+
});

0 commit comments

Comments
 (0)