I agree with everything you said, in fact, I have said the same thing in past posts. This is why I created my own templates.
The dotnet template has ‘Home/Index’ view that contains the <div aurelia-app="main">
. This also has a scripts section that looks like this (aurelia-cli v1.0.0-beta.13):
@{
ViewData["Title"] = "Home Page";
}
<div aurelia-app="main">Loading...</div>
@section scripts {
<environment names="Production">
<script type="text/javascript" asp-src-include="~/dist/common.*.chunk.js" asp-append-version="true"></script>
</environment>
<environment names="Development, Staging, Production">
<script type="text/javascript" asp-src-include="~/dist/vendor.*.chunk.js" asp-append-version="true"></script>
</environment>
<environment names="Development">
<script type="text/javascript" src="~/dist/app.bundle.js" asp-append-version="true"></script>
</environment>
<environment names="Staging, Production">
<script type="text/javascript" asp-src-include="~/dist/app.*.bundle.js" asp-append-version="true"></script>
</environment>
}
The scripts that are compiled to not look like ~/dist/app.bundle.js"
. So the quickest way to make this work (that I have found) is to change the <environment names="Development">
to look like this:
<environment names="Development">
<script type="text/javascript" asp-src-include="~/dist/*.bundle.js" asp-append-version="true"></script>
<script type="text/javascript" asp-src-include="~/dist/*.chunk.js" asp-append-version="true"></script>
</environment>
Now, ‘dotnet run’ should serve the app from the Home/Index
view. You can verify this by making a change to the content by adding a <h1>Index View</h1>
tag or something to show this.
When using au run
the Aurelia app is served from the result of the index.ejs
template being processed by a HtmlWebpackPlugin.
So in short, from a new CLI project with the specifications in your last post, changing the script references in the Home/Index
view is the fastest way to fix this issue.