Azure / static-web-apps

Azure Static Web Apps. For bugs and feature requests, please create an issue in this repo. For community discussions, latest updates, kindly refer to the Discussions Tab. To know what's new in Static Web Apps, visit https://aka.ms/swa/ThisMonth
https://aka.ms/swa
MIT License
330 stars 56 forks source link

Blazor WASM Loading Error Refused to execute script blazor.webassembly.js because its MIME type ('text/html') is not executable #539

Open mumby0168 opened 3 years ago

mumby0168 commented 3 years ago

Describe the bug Failure to load blazor wasm app net5.0 with error:

Refused to execute script from 'https://white-river-09457a803.azurestaticapps.net/_framework/blazor.webassembly.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

To Reproduce See this repository https://github.com/mumby0168/website Then see the error on this website: https://white-river-09457a803.azurestaticapps.net/

I have tried the following config files see this file and it's history in github: https://github.com/mumby0168/website/commits/master/Website.Client/wwwroot/staticwebapp.config.json

Expected behavior The app will load up.

Screenshots If applicable, add screenshots to help explain your problem.

I am using Edge version: Version 92.0.902.67 (Official build) (x86_64) on MAC OS

Additional context n/a

mumby0168 commented 3 years ago

Appears to only get this error when a package.json & package.lock.json in in my bin directory, these may just need excluding, I did also get rid of the staticwebapp.config.json.

anthonychu commented 3 years ago

@mumby0168 If you can reproduce the error (perhaps by creating a pull request which would spin up a temporary staging environment), I can take a look.

mumby0168 commented 3 years ago

I have a commit hash is that any good if not I may be able to take a branch from where it wasn't working and creating a PR from it this is the commit hash let me know if this is any good https://github.com/mumby0168/website/tree/17dc4696d90490e536309fa7936d03a2978f0033

alifeofkaizen commented 2 years ago

@mumby0168 I encountered this error too, caused by package.json issue (#173).

My workaround was to add a

rm src/Client/package.json

within the github actions yml file:

image

That said, if you do need to do need to do some npm builds in the pipeline than see #261 for a better solution than my quick workaround 👍

indcoder commented 11 months ago

@anthonychu Onxy still looks to be disregarding the build_app_command directive.

indcoder commented 11 months ago

Not just package.json but even package-lock.json(if it exists) https://github.com/HackerspaceMumbai/Visage/issues/81#issuecomment-1817462123 cc @alifeofkaizen


      - run: rm WebApp/package*.json