-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Support compressed dlls #13772
Support compressed dlls #13772
Conversation
Can you explain this to me @realLiangshiwei? Are you saying that if I add these two lines I can add the following code to the index.html (just like shown here) I should get the Brotli files and not the huge DLL´s? <script type="module">
import { BrotliDecode } from './decode.min.js';
Blazor.start({
loadBootResource: function (type, name, defaultUri, integrity) {
if (type !== 'dotnetjs' && location.hostname !== 'localhost') {
return (async function () {
const response = await fetch(defaultUri + '.br', { cache: 'no-cache' });
if (!response.ok) {
throw new Error(response.statusText);
}
const originalResponseBuffer = await response.arrayBuffer();
const originalResponseArray = new Int8Array(originalResponseBuffer);
const decompressedResponseArray = BrotliDecode(originalResponseArray);
const contentType = type ===
'dotnetwasm' ? 'application/wasm' : 'application/octet-stream';
return new Response(decompressedResponseArray,
{ headers: { 'content-type': contentType } });
})();
}
}
});
</script> Did this work for you? Because it doesn´t for me. I tried to point it out #13114 (comment) without any response. p.s |
The behavior of the CLI has changed after this PR, but it's still working. your code needs some changes. Steps: 1 public class MyProjectNameBundleContributor : IBundleContributor
{
public void AddScripts(BundleContext context)
{
context.BundleDefinitions.RemoveAll(x => x.Source.Contains("blazor.webassembly.js"));
context.Add("_framework/blazor.webassembly.js",
additionalProperties: new Dictionary<string, string>() { { "autostart", "false" } }, excludeFromBundle: true);
}
} 2
It's not handled by ABP when you use |
Thank you for the details but for some reason I can´t get it to work. These are my changes (just like yours) the blazor.boot.json.br gets created on the server allright OK there is just one file in the I see that there are no .br files in the service-worker-assets.js file on the server but I also see that it´s not getting served either... everything looks good with the service-worker Any ideas @realLiangshiwei why they are not being served? Something I´m missing? |
I think this has something to do with the web.config @realLiangshiwei? If I update my web.config (straight in the Azure Portal) with this web.config example from the docs I seem to be getting the .br files served. and lots more in the service worker it seems But I also get an error I´m guessing is because I just drop this into the web.config and is not built with it So now my questions are
Can I just add the file and it overrides your default implementation? Pinging @EngincanV since this is Blazor stuff you might know. |
Hi, I think this is not a problem with ABP, even if you create an empty Blazor wasm project(without ABP), you will have this problem. so I think you need to get help from aspnetcore |
@realLiangshiwei we got an answer, the web.config needs to be tweaked to contain the following lines <remove fileExtension=".br" />
<mimeMap fileExtension=".br" mimeType="application/brotli" /> So, you should ship a web.config file with the project or add this information to the documentation. BUT I did this to my project (with your suggested updates) and when I finally see one .br file being used. In Edge browser it the browser stops with an error, but Firefox actually downloads all the .dll´s I now get this error in the console and the page doesn´t load
Do you get the same error if you update your abp sites web.config? |
@realLiangshiwei ok so you managed to get this working? And just with your previous steps here above? Didn´t you need to add anything to the web.config file? So, this isn´t related to Microsoft at all? Did you manage to get it to work with your none-abp.io Blazor project and could you share that code with me? |
what was end result of this thread, @sturlath did you manage to run non abp/ abp blazor webassembly project with brotli compression ? |
Resolves: #13771