-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Browser StaticWebAssets sdk support #14225
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…reliable way to detect project capabilities properly
…fault value set by .NET SDK
You can test this PR using the following package version. |
kekekeks
approved these changes
Feb 9, 2024
You can test this PR using the following package version. |
maxkatz6
added a commit
that referenced
this pull request
Feb 14, 2024
* Property support StaticWebAssets SDK when it's available * Fix browser issue with dispatcher used before initialization * Use RequestAnimationFrame instead of WebEmbeddableControlRoot hack * Always include both types of assets by default, as I couldn't find a reliable way to detect project capabilities properly * Remove "WasmRuntimeAssetsLocation" override, instead let users use default value set by .NET SDK * Revert "Fix browser issue with dispatcher used before initialization" This reverts commit fc43c7e. * Add AvaloniaAllowWebGl2 prop * What
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does the pull request do?
In short, StaticWebAssets SDK allows to use caching and compression implemented on the SDK level, but only for .NET 8 apps. But we still can make our .NET 7 target compatible with that. Unfortunately, not without minor breaking changes (see below).
How was the solution implemented (if it's not obvious)?
Breaking changes
All .NET 8 WASM project will need to set "WasmRuntimeAssetsLocation" to "./" value.
Or, if they want to switch to StaticWebAssets (and gain some of its features, like compression or caching), they can do a simple migration:
import { dotnet } from './dotnet.js'
toimport { dotnet } from './_framework/dotnet.js'
.<Project Sdk="Microsoft.NET.Sdk">
to<Project Sdk="Microsoft.NET.Sdk.WebAssembly">
..NET WebAssembly templates already use
Microsoft.NET.Sdk.WebAssembly
SDK (which includes StaticWebAssetsSDK), so these can be used as an example:
https://github.com/dotnet/runtime/tree/main/src/mono/wasm/templates/templates/browser