I will keep this as short as possible.
Using Visual Studio 2017 (latest updates as of post date).
-
I created an MVC core project.
-
I created an Aurelia project via the CLI inside this project.
-
Following the CLI instructions made the changes to the Home/Index view :
@{
ViewData[“Title”] = “Home Page”;
Layout = “~/Views/Shared/_Layout_App.cshtml”;
}Loading...@section scripts {
<environment names=“Development”>
<script type=“text/javascript” src="~/dist/vendor.bundle.js" asp-append-version=“true”></script>
<script type=“text/javascript” src="~/dist/app.bundle.js" asp-append-version=“true”></script>
</environment>
<environment names=“Production”>
<script type=“text/javascript” asp-src-include="~/dist/common.*.bundle.js" asp-append-version=“true”></script>
</environment>
<environment names=“Staging, Production”>
<script type=“text/javascript” asp-src-include="~/dist/vendor.*.bundle.js" asp-append-version=“true”></script>
<script type=“text/javascript” asp-src-include="~/dist/app.*.bundle.js" asp-append-version=“true”></script>
</environment>
} -
Build the aurelia project and CTRL-F5 to run the MVC project. The Aurelia app does not load.
Why?
In the webpack.config.js, lines 43-45 inclusive:
filename: production ? '[name].[chunkhash].bundle.js' : '[name].[hash].bundle.js',
sourceMapFilename: production ? '[name].[chunkhash].bundle.map' : '[name].[hash].bundle.map',
chunkFilename: production ? '[name].[chunkhash].chunk.js' : '[name].[hash].chunk.js'
The development bundle names have a [hash]. The Index.cshtml does not expect one:
<environment names="Development">
<script type="text/javascript" src="~/dist/vendor.bundle.js" asp-append-version="true"></script>
<script type="text/javascript" src="~/dist/app.bundle.js" asp-append-version="true"></script>
</environment>
Removing the ‘[hash]’ from the development build webpack.config.js, lines 43-45 and things work again.
There is still a 404 on ‘vendor.css’ on a newly created project.