[英]Why is there an error in ChartJs.Blazor (change in ASPNETCORE_ENVIRONMENT)
I have installed a NugetPacket: ChartJs.Blazor (v1.1.0).我已经安装了 NugetPacket:ChartJs.Blazor (v1.1.0)。 In a _Host.cshtml file have added
在 _Host.cshtml 文件中添加了
<script src="_content/ChartJs.Blazor/moment-with-locales.min.js" type="text/javascript" language="javascript"></script>
<!-- Reference the included ChartJs javascript file. -->
<script src="_content/ChartJs.Blazor/Chart.min.js" type="text/javascript" language="javascript"></script>
<!-- This is the glue between the C# code and the ChartJs charts -->
<script src="_content/ChartJs.Blazor/ChartJsBlazorInterop.js" type="text/javascript" language="javascript"></script>
<!-- Some styling -->
<link rel="stylesheet" href="_content/ChartJs.Blazor/ChartJSBlazor.css" />
When the ASPNETCORE_ENVIRONMENT is set to Development it works, but when ASPNETCORE_ENVIRONMENT is changed to Production app crashes and returns error:当 ASPNETCORE_ENVIRONMENT 设置为Development时,它可以工作,但是当 ASPNETCORE_ENVIRONMENT 更改为Production应用程序崩溃并返回错误:
Microsoft.JSInterop.JSException: Could not find 'ChartJsInterop' in 'window'. Error: Could not find 'ChartJsInterop' in 'window'.
Why is there the error in the Production and not in the Development mode?为什么生产模式有错误,而开发模式没有? Any solution to this problem?
这个问题有什么解决办法吗?
Are you sure you didn't add it inside an <environment>
HTML tag?你确定你没有将它添加到
<environment>
HTML 标签中吗? Example:例子:
<environment exclude="Production">
<script src="_content/ChartJs.Blazor/ChartJsBlazorInterop.js" type="text/javascript" language="javascript"></script>
</environment>
Reference: https://docs.microsoft.com/en-us/aspnet/core/mvc/views/tag-helpers/built-in/environment-tag-helper?view=aspnetcore-5.0参考: https://docs.microsoft.com/en-us/aspnet/core/mvc/views/tag-helpers/built-in/environment-tag-helper?view=aspnetcore-5.0
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.