Angular SPA SSR Template compile error with Angular 6 #6306
Labels
area-mvc
Includes: MVC, Actions and Controllers, Localization, CORS, most templates
bug
This issue describes a behavior which is not expected - a bug.
Done
This issue has been fixed
feature-spa
Milestone
@SteveSandersonMS
Migrated from aspnet/JavaScriptServices#1619
Describe the bug
Angular SPA SSR Template compiler error with Angular 6+
To Reproduce
Steps to reproduce the behavior:
Clone https://github.com/speige/Angular6DotNetCoreSpaTemplateBug
The "master" branch is the original angular 5 template. The "Angular6Working" branch is an straight upgrade to v6 with the @angular-devkit/build-angular npm package on 0.5.5. The "Angular6broken" branch is identical except with @angular-devkit/build-angular on 0.5.6
Expected behavior
Website builds & runs
Screenshots
Additional context
Although this looks like an Angular bug, it's actually a bug in SPA AspNetCore code. The output of the Angular compiler changed slightly between v5 & v6 which made this previously masked bug in AspNetCore appear. Essentially EventedStreamReader.cs doesn't send last line's contents to listener, so it doesn't know that AngularCliBuilder is complete.
On a side note, for Angular6 upgrade, a change should be done in
https://github.com/aspnet/JavaScriptServices/blob/dev/src/Microsoft.AspNetCore.SpaServices.Extensions/AngularCli/AngularCliBuilder.cs
The "--watch" is no longer a valid command line argument in Angular 6 CLI. If you do "ng serve" it automatically does --watch, if you do "ng build" it doesn't.
I worked around this issue by changing the "build:ssr" command in my package.json from
to
which basically causes the extra command line argument to be discarded before "ng build" is called. Otherwise Angular throws an error about an invalid command line argument.
The text was updated successfully, but these errors were encountered: