Skip to content

Angular 15 regression: missing diagnostic on server build error #24612

Closed

Description

@demurgos

Command

other: ng run angular.io-example:server

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

14.2

Description

If an error occurs when compiling Angular for server-side rendering, the build process exits with error code 1 without printing any diagnostic. This makes it near impossible to figure out issues specific to SSR builds.

Minimal Reproduction

  1. Clone the Reproduction repository
  2. npm install
  3. npm build

The repro is a stripped down variant of the official universal example. There's a syntax error on line 10 of server.ts. Uncommenting from fixes the build.

Exception or Error

Full output for Angular 15:

$ npm run build

> [email protected] build
> ng run angular.io-example:server

✔ Server application bundle generation complete.
$ echo $?
1

Full output for Angular 14.2:

$ npm run build

> [email protected] build
> ng run angular.io-example:server

✔ Server application bundle generation complete.

Initial Chunk Files | Names         | Raw Size
main.js             | main          |  5.68 MB | 

                    | Initial Total |  5.68 MB

Build at: 2023-01-26T07:36:35.761Z - Hash: 2ce5cd4dbb2aca9e - Time: 6918ms

Error: server.ts:10:39 - error TS1005: 'from' expected.

10 import { AppServerModule } /* from */ './src/main.server';
                                         ~~~~~~~~~~~~~~~~~~~


Error: Optimization error [main.js]: SyntaxError: Unexpected token: punc ({)

$ echo $?
1

Your Environment

$ npm run ng version

> [email protected] ng
> ng version


     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 15.1.3
Node: 18.13.0
Package Manager: npm 8.19.3
OS: linux x64

Angular: 15.1.2
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, platform-server
... router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1501.3
@angular-devkit/build-angular   15.1.3
@angular-devkit/core            15.1.3
@angular-devkit/schematics      15.1.3
@angular/cli                    15.1.3
@nguniversal/builders           15.1.0
@nguniversal/express-engine     15.1.0
@schematics/angular             15.1.3
rxjs                            7.8.0
typescript                      4.8.4

Anything else relevant?

You have details about my environment above. I feel like I have a regular Linux machine. I'm very surprised however that this error would not have been detected earlier, so maybe something's wrong with my setup. EDIT: Reproduced in CI

The errors are properly reported with Angular 14.2.

Activity

  1. self-assigned this
    on Jan 26, 2023
  2. added 6 commits that reference this issue on Jan 26, 2023
    5fde221
    67dcf17
    bf4828e
    bfb11f0
    bf21fbe
    d8a0e69
  3. added 2 commits that reference this issue on Jan 26, 2023
    317452e
    f35e990
  4. angular-automatic-lock-bot commented on Feb 26, 2023

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  5. locked and limited conversation to collaborators on Feb 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions