I am using MatBlazor 2.6.0 in a server side blazor project. I did the following steps:
- Added MatBlazor to the project (2.6.0)
- Included
@Using MatBlazorin my _Imports.razor file - Added the static file to _Hosts.cshtml
When I run the project I get an error:
Microsoft.JSInterop.JSException: Could not find 'matBlazor' in 'window'.
When I check the view source in the browser, I see there is a reference:
<script src="_content/MatBlazor/dist/matBlazor.js"></script>
But when I check the contents of that .js file it is empty, any idea on what I could be doing wrong here?
If your _Host.cshtml head looks like this:
Then maybe the problem lies with how it was added to the project. Did you use the Nuget Package manager in Visual Studio? It is strange for the file to be empty I agree.