I have updated my code from dotnet 6 to dotnet 7. It builds and everything looks fine until i run it. Then i get the error message:
Uncaught SyntaxError: Cannot use 'import.meta' outside a module (at dotnet.7.0.0.amub20uvka.js:8:27)
Any ideas?
Update outdated packages
Clear cache
If you have users and they have old cached files,try adding a query string in the script tag for blazor.webassembly.js in index.html
Example: src="_framework/blazor.webassembly.js?v=20230301"
Things you can try:
Check your dotnet version in project.csproj:
<TargetFramework>net7.0</TargetFramework>
Check your versions in project.csproj for:
Microsoft.AspNetCore.Components.WebAssembly and
Microsoft.AspNetCore.Components.WebAssembly.DevServer
(This point solved my problem last time for me)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With