getsentry / sentry-javascript

Official Sentry SDKs for JavaScript
https://sentry.io
MIT License
8.02k stars 1.59k forks source link

feat(angular): Support Angular 19 #14398

Closed Lms24 closed 4 days ago

Lms24 commented 4 days ago

Angular 19 was released. This PR adds support for the new major version by bumping peer dependencies and adding an Angular 19 e2e test app.

From reading the changelog and the updated APF specification, it doesn't seem like there are any changes of concern for our SDK. Noteable exception:

The APP_INITIALIZER token was DI token was deprecated in favour of provideAppinitializer. This results in a slight update how to configure our SDK's TraceService in app.config.ts:

// Angular 18
export const appConfig: ApplicationConfig = {
  providers: [
    // other providers
    {
      provide: TraceService,
      deps: [Router],
    },
    {
      provide: APP_INITIALIZER,
      useFactory: () => () => {},
      deps: [TraceService],
      multi: true,
    },
  ],
};

// Angular 19
export const appConfig: ApplicationConfig = {
  providers: [
    // other providers
    {
      provide: TraceService,
      deps: [Router],
    },
    provideAppInitializer(() => {
      inject(TraceService);
    }),
  ],
};

I will update our docs accordingly.

closes https://github.com/getsentry/sentry-javascript/issues/14386