EdCharbeneau / BlazorSize

Blazor browser size interop for matchMedia and browser window size at runtime.
336 stars 39 forks source link

Disallowed MIME type after upgrade to latest version #73

Closed philvessey closed 2 years ago

philvessey commented 2 years ago

Hi

Upgraded package to 6.1.1 and now get this error in the console - no other change in the code from 6.1.0

_content/BlazorPro.BlazorSize/blazorSizeMediaModule.js was blocked because of a disallowed MIME type (“text/html”)

Has something changed that has caused this?

EdCharbeneau commented 2 years ago

Can you please post the full error and your configuration: .NET version, Program.cs and index.html/cshtml

BlazorSize is tested end to end which includes a check during each testing phase for console errors. No such errors are happening in e2e.

Thanks

Rikshy commented 2 years ago

Hi

I also receive a similar error. TBF: I just rolled out the first version with blazorSize, previously I only used it on my LM. Here is the error from my Browser: (I know for me it doesn't show any MIME type) grafik

I am using .NET 6.0 Program.cs

Thanks, and sorry if this doesn't fit here

philvessey commented 2 years ago

Here is the information - safari reports it as 404, Firefox as invalid mime type. If rollback to 6.1.0 everything works fine - just bumping to 6.1.1 results in error with no other code changes.

error index program
EdCharbeneau commented 2 years ago

Thanks for the extra details. I will try to reproduce this and issue a fix.

@philvessey What project type is this? And what .NET version is the project on?

philvessey commented 2 years ago

@EdCharbeneau blazor wasm on net6.0 against sdk 6.0.1 and tried 6.0.2

It happens both locally and on a deploy to azure static web apps.

EdCharbeneau commented 2 years ago

@philvessey I've tried creating every variety of Blazor project using two different machines. I can't seem to reproduce this.

I noticed your index file uses both _framework/blazor.webassembly.js and the TagHelper <component ...>.

I'm not sure what type of project this is.

Also, can you try clearing your /bin and /obj folders? There could be something cached in here causing issues.

I'm still working on the issue, just running out of potential problems.

philvessey commented 2 years ago

@EdCharbeneau sounds like something my end then - I'll see if I can get it going with a simple dotnet new and go from there - I'll report back.

Puzzled a bit why previous version works - would there be a caching issue on static web apps as it takes down the staging each time?

EdCharbeneau commented 2 years ago

"Puzzled a bit why previous version works - would there be a caching issue on static web apps as it takes down the staging each time?"

Doesn't make sense to me either.

There were hardly any changes to the codebase this update. I removed some log statements and updated two event handlers. Nothing that could be related IMO

philvessey commented 2 years ago

@EdCharbeneau somethings not right - I get the same error on a vanilla dotnet new blazorwasm project. All I did here was add the package, add builder.Services.AddMediaQueryService(); to program cs and then wrap MediaQueryList to the Index.razor - and I get the error below.

Screenshot 2022-02-12 at 15 55 48
philvessey commented 2 years ago

@EdCharbeneau on above when I change to 6.1.0 - no issue and everything good again.

EdCharbeneau commented 2 years ago

Windows, Linux, or Mac?

Maybe there's a file name convention or something breaking it. I'm on Windows, maybe that's why I don't see it?

philvessey commented 2 years ago

I'm Mac locally - guessing static web app is Linux?

philvessey commented 2 years ago

I notice in the scripts folder there are two files for the media module - one has capital B, other lowercase - is this causing it do you think as the console error suggests its trying to load the lower case one.

Screenshot 2022-02-12 at 19 40 28
EdCharbeneau commented 2 years ago

This is probably it. I thought I fixed this before, there must have been a regression when I merged some branches.

I'll post a prerelease build shortly for you to test. Yay Linux Vs. NTFS

philvessey commented 2 years ago

The worse kind of issues 😔

EdCharbeneau commented 2 years ago

@philvessey Please enable pre-release packages and update to 6.1.22-pre. If this fixes your issue I'll create a full release. https://www.nuget.org/packages/BlazorPro.BlazorSize/6.1.22-pre

EdCharbeneau commented 2 years ago

The worse kind of issues

Especially when you fix them but Git seems to keep the old file name, because case is not a "change you can commit". I had to remove it, commit it, then add it back, commit again. 😡

philvessey commented 2 years ago

@EdCharbeneau pre-release version is good to go - issue fixed ☺️

EdCharbeneau commented 2 years ago

Fixed with 6.1.2 https://www.nuget.org/packages/BlazorPro.BlazorSize/6.1.2

Thanks for submitting and working through this patiently 🍻

philvessey commented 2 years ago

Not a problem at all - happy to help!