-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[wasm] Embed HotReload in WebAssembly SDK #52710
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 8 commits
7ec7aa6
415a97b
1d61ff1
c777ede
366479c
43ca45c
9b27e95
0b699ca
a5c04c4
db3697d
724f7f0
438b349
d1eb14f
b0b6233
d7a29f0
c8bb76b
66273f1
09dcf66
a16649e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,10 +21,46 @@ Copyright (c) .NET Foundation. All rights reserved. | |
| <_WasmEnableHotReload Condition="'$(_WasmEnableHotReload)' == '' and '$(Configuration)' != 'Debug'">false</_WasmEnableHotReload> | ||
| <_WasmEnableHotReload Condition="'$(_WasmEnableHotReload)' == '' and '$(TargetFrameworkIdentifier)' == '.NETCoreApp' and $([MSBuild]::VersionGreaterThanOrEquals('$(TargetFrameworkVersion)', '10.0'))">true</_WasmEnableHotReload> | ||
| </PropertyGroup> | ||
| <Target Name="_ImplicitlyReferenceHotReload" BeforeTargets="ProcessFrameworkReferences"> | ||
| <ItemGroup Condition="'$(_WasmEnableHotReload)' == 'true'"> | ||
| <PackageReference Include="Microsoft.DotNet.HotReload.WebAssembly.Browser" Version="$(NETCoreSdkVersion)" IsImplicitlyDefined="true" /> | ||
| <Target Name="_ImplicitlyReferenceHotReload" BeforeTargets="ResolveProjectStaticWebAssets" AfterTargets="ResolveStaticWebAssetsConfiguration" Condition="'$(_WasmEnableHotReload)' == 'true'"> | ||
| <PropertyGroup> | ||
| <_WasmHotReloadRoot>$([MSBuild]::NormalizeDirectory($(MSBuildThisFileDirectory), '..', 'hotreload'))</_WasmHotReloadRoot> | ||
| <_WasmHotReloadDllPath Condition="$([MSBuild]::VersionGreaterThanOrEquals('$(TargetFrameworkVersion)', '10.0'))">net10.0</_WasmHotReloadDllPath> | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @tmat Do you prefer to multi-target the dll or pin it to .NET 10?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's pin to .NET 10 until we need runtime features that need higher version. It's simpler and reduces SDK size.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, let's target
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would rather land it on main and backport it to 10. We are testing some scenarios only on main in runtime and I have some unpleasant memories when changes arrived there later due to delayed forward flow in SDK |
||
| <_WasmHotReloadDllPath Condition="$([MSBuild]::VersionGreaterThanOrEquals('$(TargetFrameworkVersion)', '11.0'))">net11.0</_WasmHotReloadDllPath> | ||
| </PropertyGroup> | ||
| <ItemGroup Condition="'$(_WasmHotReloadDllPath)' != ''"> | ||
| <ReferenceCopyLocalPaths Include="$(_WasmHotReloadRoot)\$(_WasmHotReloadDllPath)\Microsoft.DotNet.HotReload.WebAssembly.Browser.dll"> | ||
| <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
| <CopyToPublishDirectory>Never</CopyToPublishDirectory> | ||
| </ReferenceCopyLocalPaths> | ||
| <_WasmHotReloadModule Include="$(_WasmHotReloadRoot)\wwwroot\Microsoft.DotNet.HotReload.WebAssembly.Browser.lib.module.js"> | ||
| <TargetPath>_framework\Microsoft.DotNet.HotReload.WebAssembly.Browser.lib.module.js</TargetPath> | ||
| <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
| <CopyToPublishDirectory>Never</CopyToPublishDirectory> | ||
| </_WasmHotReloadModule> | ||
| <_WasmHotReloadModule OriginalItemSpec="%(Identity)" /> | ||
| </ItemGroup> | ||
|
|
||
| <DefineStaticWebAssets | ||
| CandidateAssets="@(_WasmHotReloadModule)" | ||
| FingerprintCandidates="$(StaticWebAssetsFingerprintContent)" | ||
| FingerprintPatterns="@(StaticWebAssetFingerprintPattern)" | ||
| SourceId="$(PackageId)" | ||
| SourceType="Computed" | ||
| ContentRoot="$(_WasmHotReloadRoot)\wwwroot\" | ||
| BasePath="$(StaticWebAssetBasePath)" | ||
| AssetKind="Build" | ||
| AssetTraitName="JSModule" | ||
| AssetTraitValue="JSLibraryModule" | ||
| PropertyOverrides="AssetTraitName;AssetTraitValue"> | ||
| <Output TaskParameter="Assets" ItemName="StaticWebAsset" /> | ||
| <Output TaskParameter="Assets" ItemName="_WasmHotReloadModuleStaticWebAsset" /> | ||
| </DefineStaticWebAssets> | ||
| <DefineStaticWebAssetEndpoints | ||
| CandidateAssets="@(_WasmHotReloadModuleStaticWebAsset)" | ||
| ContentTypeMappings="@(StaticWebAssetContentTypeMapping)" | ||
| > | ||
| <Output TaskParameter="Endpoints" ItemName="StaticWebAssetEndpoint" /> | ||
| </DefineStaticWebAssetEndpoints> | ||
| </Target> | ||
|
|
||
| <Import Sdk="Microsoft.NET.Sdk.Publish" Project="Sdk.targets" Condition="'$(_WasmSdkImportsMicrosoftNETSdkPublish)' == 'true'" /> | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.