Skip to content

Commit

Permalink
[browser] Use browser cache in WasmApp-style projects by default (#90662
Browse files Browse the repository at this point in the history
)
  • Loading branch information
maraf committed Aug 16, 2023
1 parent d31b39e commit d267844
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/mono/wasm/build/WasmApp.targets
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@
<WasmStripILAfterAOT Condition="'$(WasmStripILAfterAOT)' == ''">false</WasmStripILAfterAOT>

<WasmRuntimeAssetsLocation Condition="'$(WasmRuntimeAssetsLocation)' == ''">_framework</WasmRuntimeAssetsLocation>
<BlazorCacheBootResources Condition="'$(BlazorCacheBootResources)' == ''">true</BlazorCacheBootResources>
</PropertyGroup>

<ItemGroup>
Expand Down Expand Up @@ -449,6 +450,7 @@
WasmIncludeFullIcuData="$(WasmIncludeFullIcuData)"
WasmIcuDataFileName="$(WasmIcuDataFileName)"
RuntimeAssetsLocation="$(WasmRuntimeAssetsLocation)"
CacheBootResources="$(BlazorCacheBootResources)"
>
<Output TaskParameter="FileWrites" ItemName="FileWrites" />
</WasmAppBuilder>
Expand Down
4 changes: 4 additions & 0 deletions src/tasks/WasmAppBuilder/WasmAppBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }

// <summary>
// Extra json elements to add to _framework/blazor.boot.json
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit d267844

Please sign in to comment.