Describe the bug
Running a .NET Core 3.0
+ Angular 9 cli
(version 9.0.0-rc.2 as of this post) with the angular cli build option progress
set to false
will hang until the StartupTimeout
expires (default: 120 seconds)
To Reproduce
I created a repo with a bare bones .NET Core 3.0
+ Angular 9 cli
application to demo the bug. Simply clone, npm build
the ClientApp folder, and dotnet run
. Or you can follow the steps below to do this from scratch:
- Ensure you have
.NET Core 3.0
installed - Create a .NET Core application with the current Angular templates by typing:
dotnet new angular -n HelloWorld
- Navigate to the
ClientApp
folder and install the Typescript helper functions required for Angular 9 by typing:npm install tslib@latest
- Update to Angular 9 by typing:
ng update @angular/core @angular/cli --next
- Ensure the
progress
build option in theangular.json
file is set to false - Run the application by navigating back to the root folder and typing:
dotnet run
- Launch a browser and navigate to:
https://localhost:5001
The application will hang and eventually timeout.
Further technical details
This appears to be caused by a change in how ng serve
outputs to the console in the new Angular 9 CLI. The AngularCliMiddleware
makes a WaitForMatch()
method call against the standard output to signify when the Angular assets have been generated and the web server is ready to receive requests (Line 84). However, unless the progress
option is set to true in the angular.json
file you never see the expected line.
UPDATE: Updated to .NET Core 3.1 and Angular 9.0.0-rc.5. Same issue. New, simpler workaround is to modify your npm start
script to perform a simple echo
prior to ng serve
(see comment below)
UPDATE (6/5/2020): Lots of recent comments so I figured I'd share exactly what has worked for me with every release of .NET
and Angular
since my original post. Update your package.json
like so:
"scripts": {
"ng": "ng",
"start": "echo hello && ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
}
No comments:
Post a Comment