Reputation: 12615
I am using MatBlazor 2.6.0 in a server side blazor project. I did the following steps:
@Using MatBlazor
in my _Imports.razor fileWhen 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?
Upvotes: 1
Views: 670
Reputation: 270
I had to change the ASPNETCORE_ENVIRONMENT environment variable from "Local" to "Development" and it magically started working... still looking for why.
see https://github.com/SamProf/MatBlazor/issues/375#issuecomment-852946500 for details
Upvotes: 0
Reputation: 553
If your _Host.cshtml head looks like this:
<head>
...
<!--MatBlazor-->
<script src="_content/MatBlazor/dist/matBlazor.js"></script>
<link href="_content/MatBlazor/dist/matBlazor.css" rel="stylesheet" />
...
</head>
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.
Upvotes: 1