Skip to content

Angular 17 with esbuild and JIT compilation have obfuscated stacktraces #27919

@dufrenb

Description

@dufrenb

Command

serve

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

angular 17.x with latest webpack

Description

Since we update from webpack builder to esbuild, the error raced when a service is injected without being provided first does not show the service name. It's very annoying as it can be very painful to find out which service is missing in a very big application.

The stacktrace given with esbuild
esbuild_provider_stacktrace

The stacktrace given with webpack
webpack_provider_stacktrace

Minimal Reproduction

Here is a minimal reproduction project https://github.com/padoa/angular_esbuild_example. You just have to serve the application using yarn serve or yarn serve:webpack and then click on one of the two buttons to see the error raced in the console.

Exception or Error

No response

Your Environment

~/angular_esbuild_example $> ng version

Angular CLI: 17.3.8
Node: 18.18.0
Package Manager: npm 9.8.1
OS: darwin arm64

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

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1703.8
@angular-devkit/build-angular   17.3.8
@angular-devkit/core            17.3.8
@angular-devkit/schematics      17.3.8
@angular/cli                    17.3.8
@schematics/angular             17.3.8
rxjs                            7.8.1
typescript                      5.4.5
zone.js                         0.14.7

Anything else relevant?

We found out that the following issue (angular/angular#55304) was incriminating the standalone API, so in the reproduction project we implemented both NgModule and Standalone but still the error is obfuscated.
Also, using AOT compilation instead of JIT in development resolves this issue. Is there any reason why JIT compilation with esbuild does not show the class name in stacktraces ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions