@@ -48,6 +48,7 @@ To use **ngx-fastboot**, import the `fast` function and call it with your Angula
48
48
49
49
#### Before
50
50
51
+ ` main.ts `
51
52
``` typescript
52
53
import { AppComponent } from ' ./app.component' ;
53
54
import { bootstrapApplication } from ' @angular/platform-browser' ;
@@ -70,6 +71,7 @@ bootstrapApplication(AppComponent, {
70
71
71
72
#### After
72
73
74
+ ` main.ts `
73
75
``` typescript
74
76
import { AppComponent } from ' ./app.component' ;
75
77
import { bootstrapApplication } from ' @angular/platform-browser' ;
@@ -107,27 +109,16 @@ export default [
107
109
### Sentry Integration Example
108
110
This example shows how to integrate Sentry with ngx-fastboot for error monitoring and performance tracing in your Angular application.
109
111
110
- sentry.config.ts
112
+ ` src/app/configs/ sentry.config.ts`
111
113
``` typescript
112
114
import { APP_INITIALIZER , EnvironmentProviders , ErrorHandler , Provider } from ' @angular/core' ;
113
115
import { Router } from ' @angular/router' ;
114
116
import {
115
- browserTracingIntegration ,
116
117
createErrorHandler ,
117
118
init ,
118
- replayIntegration ,
119
119
TraceService ,
120
120
} from ' @sentry/angular-ivy' ;
121
121
122
- export function initSentryConfig() {
123
- init ({
124
- dsn: ' <your-dsn>' ,
125
- integrations: [browserTracingIntegration (), replayIntegration ()],
126
- ... etc
127
- });
128
- console .info (' Sentry initialized.' );
129
- }
130
-
131
122
export default [
132
123
{
133
124
provide: ErrorHandler ,
@@ -149,7 +140,25 @@ export default [
149
140
] satisfies Array <Provider | EnvironmentProviders >;
150
141
```
151
142
152
- main.ts
143
+ ` src/app/configs/sentry.init.ts `
144
+ ``` typescript
145
+ import {
146
+ browserTracingIntegration ,
147
+ init ,
148
+ replayIntegration ,
149
+ } from ' @sentry/angular-ivy' ;
150
+
151
+ export function initSentryConfig() {
152
+ init ({
153
+ dsn: ' <your-dsn>' ,
154
+ integrations: [browserTracingIntegration (), replayIntegration ()],
155
+ ... etc
156
+ });
157
+ console .info (' Sentry initialized.' );
158
+ }
159
+ ```
160
+
161
+ ` src/main.ts `
153
162
``` typescript
154
163
import { AppComponent } from ' ./app.component' ;
155
164
import { bootstrapApplication } from ' @angular/platform-browser' ;
@@ -160,12 +169,11 @@ fast(bootstrapApplication, AppComponent, {
160
169
() => import (' ./app/configs/sentry.config' ),
161
170
],
162
171
})
163
- .then (async () => {
164
- return import (' ./app/configs/sentry.config' ).then ((config ) => config .initSentryConfig ());
165
- })
166
- .catch ((err ) =>
167
- console .error (err ),
168
- );
172
+ .then (() => import (' ./app/configs/sentry.init' )
173
+ .then ((init ) => init .initSentryConfig ()))
174
+ .catch (error => {
175
+ console .error (' Error bootstrapping the app' , error );
176
+ });
169
177
170
178
```
171
179
0 commit comments