-
-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ASP.NET Core template app does not run #979
Comments
This also applies to 1.0.0-beta.6. It seems to be related to this recent commit in the webpack.config.template which adds some optimisations but breaks the develop build of the aspnet core app. I made it work by changing the following file Views/Home/Index.cshtml: @{
ViewData["Title"] = "Home Page";
}
<div aurelia-app="main">Loading...</div>
@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>
} to this @{
ViewData["Title"] = "Home Page";
}
<div aurelia-app="main">Loading...</div>
@section scripts {
<environment names="Development">
<script type="text/javascript" asp-src-include="~/dist/vendor.*.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>
} not really sure if this is the correct fix but it works. |
@chrisckc could you have a look of this? |
@huochunpeng I may have overlooked the other environments in the |
@huochunpeng I would assume including everything in What I do know is that before the removal of the |
I guess it's because of the file name change. Here are files generated with
It's not |
@huochunpeng this is the conclusion I came to which is why my Index.cshtml amendment works. <script type="text/javascript" asp-src-include="~/dist/vendor.*.js" asp-append-version="true"></script> which generates the following html: <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Home Page | Aurelia</title>
<link rel="stylesheet" href="/dist/vendor.css">
</head>
<body>
<div aurelia-app="main">Loading...</div>
<script type="text/javascript" src="/dist/vendor.50f6d34b46a9fb34d303.chunk.js?v=tYl2JAtHCZoHKNqmxd_PuzPWZ5fmDwDsT6v3pOUNuME"></script>
<script type="text/javascript" src="/dist/vendor.aurelia-binding.50f6d34b46a9fb34d303.chunk.js?v=TO60jtGxPrwn_SpAEcNvBJJu9qMLQas7sepATWJIZNI"></script>
<script type="text/javascript" src="/dist/vendor.aurelia-templating.50f6d34b46a9fb34d303.chunk.js?v=hQ2bcCi2qYxAn3wXpI460apCqDUl2LEcsF4BFKUzuRI"></script>
<script type="text/javascript" src="/dist/vendor.aurelia.50f6d34b46a9fb34d303.chunk.js?v=w1X57SV4WfQIU2tSnSRJGJOlZAjdXmJfPmgM9DaMnqY"></script>
<script type="text/javascript" src="/dist/vendor.bluebird.50f6d34b46a9fb34d303.chunk.js?v=LjoNM8hRKr-EpF40Ezo_P88vqRVooxxOL6Lgwo3CXKE"></script>
<script type="text/javascript" src="/dist/app.bundle.js?v=BXRpF3iR4UgfU6M9O-rUvclNSeZelKYYe9ma5Je8tAM"></script>
</body>
</html> |
@milkshakeuk @huochunpeng This is unfortunate, my testing was done using the new style ASP.NET Core Spa method which use SpaProxy in dev mode and serve the Aurelia bundle from ClientApp/dist when in production mode. Using that method there is no tie-in between the MVC Index view and the SPA code. I guess this kind of issue may be one of the reasons why Microsoft have moved away from the old method that uses the WebpackDevMiddleware, this is what is currently generated by the Aurelia CLI. I think that the CLI should be updated to generate the dotnet template using the SpaProxy method to keep it inline with the current Microsoft SPA templates. This will prevent any issues arising when users start to optimise their webpack config. It will also fill the gap now that Microsoft no longer provide an up to date Aurelia SPA template. In the meantime this should be fixed as suggested above with comments added to point out the link between the scripts and the webpack optimisation config. |
@chaskim I have not seen the latest ASP.Net Core SpaProxy method used in any tutorials or in the spa templates that microsoft provide do you have any examples. however if this is the case I agree the aurelia cli should share the approach. |
@EisenbergEffect Perhaps a better approach than updating the CLI would be to convince the ASP.NET Core team to reintroduce the Aurelia template into their core templates package https://github.com/aspnet/Templating and then ditch the CLI generated.NET core template. This should also be a great help in driving the adoption of Aurelia. |
@milkshakeuk I have a blog post here which links to a git hub repo using the new method: |
alternatively the aurelia team could create there own custom aurelia template ala custom-templates. |
@chrisckc Thanks for the link. |
@milkshakeuk I wish we could convince them. For whatever reason they refuse to support anything besides Angular and React even with Angular moving into decline and React beginning to be supplanted by other VDom-based frameworks. When I was employed at Microsoft I even internally gave a "piece of my mind" to a few people about this but it didn't seem to make any difference. On the whole, I'm not convinced that the .NET team is really on top of front-end or knowledgeable about what is going on in this space. Their particular "data-driven" approaches to driving this are quite seriously flawed as well. So, we're probably on our own here. @chrisckc Is there something we could do as the Aurelia team to make an official template available to ASP.NET devs who want it? From your post, it seems like you've got all the details worked out. We just need to package it up somehow to plug into the |
Looks like the .NET team are open to providing links to community created 'dotnet new' templates in their documentation, here is the issue and discussion i found a while back on the retiring of the templates:
I am willing to help in the creation of an Aurelia template for We should probably use the code from the skeleton repo, or the same code thats going to be outputted by the CLI when it's eventually combined, with the addition of an example WebApi call. We could even go a step further and offer a template which implements JWT authorisation against the dotnet "individual auth" setup that is created using Do you want to open up another issue/feature request for this? |
I'd like to start with the most basic setup that makes sense and then iterate on it from there based on community feedback. Our plan for the skeletons has been to have them be generated from the CLI and we'd want to have things be as close as possible with the ASP.NET integration as well. @JeroenVinke Any notion of how far we are away from being able to generate the skeletons from the CLI? |
Oh, in case it wasn't clear, @chrisckc we'd love your assistance in creating the Aurelia template :) I think the community will be very happy about this. |
No problem, i have created a new issue to continue discussions on this, in the meantime should this issue be fixed in the CLI by editing Index.cshtml? If so can someone else do a pull request for that please? @milkshakeuk ? |
@chrisckc @EisenbergEffect pull request created, though I did update the template to aspnet core 2.1 whilst I was there, basing it on newer |
I'm submitting a bug report
1.0.0-beta.5
Please tell us about your environment:
Operating System:
Windows 10
Node Version:
8.9.0
5.6.0
Browser:
all
Language:
TypeScript 3.0
Loader/bundler:
Webpack
Current behavior:
Use
au new
to create a new Typescript/AspNetCore/Webpack project. Once it is complete and dependencies are installed, run project usingdotnet run
. The app loads with the word "Loading..." and nothing happens. In the console, a messageLoading failed for the <script> with source “http://localhost:5000/dist/vendor.bundle.js”.
is shown.Looking at the dist folder, it indeed does not have that bundle. There is a app.bundle.js but no vendor.bundle.js.
When app is run using
au run
the app loads properly, and different output is shown in dist/ folder. Also building ASP.NET core app does not create/recreate the dist/ folder.To load and show Hello World.
The text was updated successfully, but these errors were encountered: