From d2678442c80cdd15ca7d14c013d31a7683de1ed6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Fi=C5=A1era?= Date: Wed, 16 Aug 2023 17:30:19 +0200 Subject: [PATCH] [browser] Use browser cache in WasmApp-style projects by default (#90662) --- src/mono/wasm/build/WasmApp.targets | 2 ++ src/tasks/WasmAppBuilder/WasmAppBuilder.cs | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/mono/wasm/build/WasmApp.targets b/src/mono/wasm/build/WasmApp.targets index be1b7214e2c0b..bf01bec5d5625 100644 --- a/src/mono/wasm/build/WasmApp.targets +++ b/src/mono/wasm/build/WasmApp.targets @@ -152,6 +152,7 @@ false _framework + true @@ -449,6 +450,7 @@ WasmIncludeFullIcuData="$(WasmIncludeFullIcuData)" WasmIcuDataFileName="$(WasmIcuDataFileName)" RuntimeAssetsLocation="$(WasmRuntimeAssetsLocation)" + CacheBootResources="$(BlazorCacheBootResources)" > diff --git a/src/tasks/WasmAppBuilder/WasmAppBuilder.cs b/src/tasks/WasmAppBuilder/WasmAppBuilder.cs index 9c7d8a6799134..869feb1277011 100644 --- a/src/tasks/WasmAppBuilder/WasmAppBuilder.cs +++ b/src/tasks/WasmAppBuilder/WasmAppBuilder.cs @@ -27,6 +27,7 @@ public class WasmAppBuilder : WasmAppBuilderBaseTask public bool WasmIncludeFullIcuData { get; set; } public string? WasmIcuDataFileName { get; set; } public string? RuntimeAssetsLocation { get; set; } + public bool CacheBootResources { get; set; } // // Extra json elements to add to _framework/blazor.boot.json @@ -102,6 +103,9 @@ protected override bool ExecuteInternal() globalizationMode = GetGlobalizationMode().ToString().ToLowerInvariant() }; + if (CacheBootResources) + bootConfig.cacheBootResources = CacheBootResources; + // Create app var runtimeAssetsPath = !string.IsNullOrEmpty(RuntimeAssetsLocation) ? Path.Combine(AppDir, RuntimeAssetsLocation)