我有通常的wwwroot/app/main.js
文件,并使用<my-app>
内的选择器index.cshtml
这是默认设置,可以在Views/Home
中找到,一切正常。 main.js位于localhost:5000/app/main.js
下,但只要我在同一.cshtml
路径下的另一个Views/Home
文件中使用选择器,我就会收到404错误,我看到应用程序是在localhost:5000/Home/app/main.js
下寻找main.js。显然是在错误的路径中寻找文件。
我尝试更改
<script>
System.import('app').catch(function(err){ console.error(err); });
</script>
在_Layout.cshtml
中找到,为它提供了main.js的完整路径,但它没有用。