Skip to content

Commit 2e89d40

Browse files
committed
Updates
1 parent c3b0e78 commit 2e89d40

File tree

1 file changed

+21
-10
lines changed
  • aspnetcore/release-notes/aspnetcore-10/includes

1 file changed

+21
-10
lines changed

aspnetcore/release-notes/aspnetcore-10/includes/blazor.md

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ For more information, see [`HttpClient` and `HttpRequestMessage` with Fetch API
139139

140140
### Client-side fingerprinting
141141

142-
The release of .NET 9 introduced [server-side fingerprinting](https://en.wikipedia.org/wiki/Fingerprint_(computing)) of static assets in Blazor Web Apps with the introduction of [Map Static Assets routing endpoint conventions (`MapStaticAssets`)](xref:fundamentals/static-files), the [`ImportMap` component](xref:blazor/fundamentals/static-files#importmap-component), and the <xref:Microsoft.AspNetCore.Components.ComponentBase.Assets?displayProperty=nameWithType> property (`@Assets["..."]`) to resolve fingerprinted JavaScript modules. For .NET 10, you can opt-into client-side fingerprinting of JavaScript modules for standalone Blazor WebAssembly apps.
142+
The release of .NET 9 introduced [server-side fingerprinting](https://en.wikipedia.org/wiki/Fingerprint_(computing)) of static assets in Blazor Web Apps with the introduction of [Map Static Assets routing endpoint conventions (`MapStaticAssets`)](xref:fundamentals/static-files), the [`ImportMap` component](xref:blazor/fundamentals/static-files#importmap-component), and the <xref:Microsoft.AspNetCore.Components.ComponentBase.Assets?displayProperty=nameWithType> property (`@Assets["..."]`) to resolve fingerprinted JavaScript (JS) modules. For .NET 10, you can opt-into client-side fingerprinting of JS modules for standalone Blazor WebAssembly apps.
143143

144-
In standalone Blazor WebAssembly apps during build/publish, the framework overrides placeholders in `index.html` with values computed during build to fingerprint static assets. A fingerprint is placed into the `blazor.webassembly.js` script file name.
144+
In standalone Blazor WebAssembly apps during build and publish, the framework overrides placeholders in `index.html` with values computed during build to fingerprint static assets. A fingerprint is placed into the `blazor.webassembly.js` script file name.
145145

146146
The following markup must be present in the `wwwroot/index.html` file to adopt the fingerprinting feature:
147147

@@ -174,24 +174,35 @@ In the project file (`.csproj`), add the `<OverrideHtmlAssetPlaceholders>` prope
174174
</Project>
175175
```
176176

177-
Any JS module in `index.html` with the fingerprint marker is fingerprinted by the framework. For example, a module named `scripts.js` in the app's `wwwroot/js` folder is fingerprinted by adding `#[.{fingerprint}]` before the file extension (`.js`):
177+
In the following example, all developer-supplied JS files are modules with a `.js` file extension.
178+
179+
Any JS module in `index.html` with the fingerprint marker is fingerprinted by the framework, including when the app is published. A module named `scripts.js` in the app's `wwwroot/js` folder is fingerprinted by adding `#[.{fingerprint}]` before the file extension (`.js`):
178180

179181
```html
180-
<script src="js/scripts#[.{fingerprint}].js"></script>
182+
<script type="module" src="js/scripts#[.{fingerprint}].js"></script>
181183
```
182184

183-
To fingerprint additional JS modules with a different file extension or fingerprint expression in standalone Blazor WebAssembly apps, use the `<StaticWebAssetFingerprintPattern>` property in the app's project file (`.csproj`).
185+
Specify the fingerprint expression with the `<StaticWebAssetFingerprintPattern>` property in the app's project file (`.csproj`):
186+
187+
```xml
188+
<ItemGroup>
189+
<StaticWebAssetFingerprintPattern Include="JSModule" Pattern="*.js"
190+
Expression="#[.{fingerprint}]!" />
191+
</ItemGroup>
192+
```
184193

185-
In the following example, a fingerprint is added for all developer-supplied `.mjs` files in the app:
194+
If you adopt the `.mjs` file extension for JS modules, set the `Pattern` attribute:
186195

187196
```xml
188-
<StaticWebAssetFingerprintPattern Include="JSModule" Pattern="*.mjs"
189-
Expression="#[.{fingerprint}]!" />
197+
<ItemGroup>
198+
<StaticWebAssetFingerprintPattern Include="JSModule" Pattern="*.mjs"
199+
Expression="#[.{fingerprint}]!" />
200+
</ItemGroup>
190201
```
191202

192-
The files are automatically placed into the import map:
203+
Files are placed into the import map:
193204

194-
* Automatically for Blazor Web App CSR.
205+
* Automatically for Blazor Web App client-side rendering (CSR).
195206
* When opting-into module fingerprinting in standalone Blazor WebAssembly apps per the preceding instructions.
196207

197208
When resolving the import for JavaScript interop, the import map is used by the browser resolve fingerprinted files.

0 commit comments

Comments
 (0)