Document Angular SDK installation for standalone component Angular projects
Core or SDK?
Platform/SDK
Which part? Which one?
@sentry/angular-ivy
Description
Since Angular 16 (I belive), entire Angular applications can created without declaring a single NgModule, by only using standalone components.
We currently instruct users to declare our providers (ErrorHandler, TraceService) in app.module.ts which doesn't exist in this case.
Suggested Solution
Add instructions how to declare providers in app.config.ts. There are no big differences except for the used Angular API but we should nevertheless cover this in our docs.
Kind of blocked on https://github.com/getsentry/sentry-javascript/issues/9376 since I first want to figure out the best course of action around using the SDK in SSR Angular 17 apps.
I suggest you to create dedicated provideSentryErrorHandler() function, which will do this under-the-hood:
import { createErrorHandler } from ‘@sentry/angular-ivy’;
export function provideSentryErrorHandler(opts: SomeOptsType = {}) {
return {
provide: ErrorHandler,
useValue: createErrorHandler(opts)
}
}
and use it in standalone application just by calling this fn like this:
providers: [
provideSentryErrorHandler({ showDialog: true })
]
Good idea! Would you be interested in opening a PR for this? No worries if not, I'll get to it next week.
PR for provider fn or for docs?:)
@zip-fa I was thinking about the provider helper functions but any help is appreciated :)
I wrote up an issue to track the provider functions in the SDK repo: https://github.com/getsentry/sentry-javascript/issues/9407.
Routing to @getsentry/product-owners-sdks-web-frontend for triage ⏲️