File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -421,18 +421,21 @@ export function instrumentBuild(build: ServerBuild): ServerBuild {
421
421
// Because the build can change between build and runtime.
422
422
// So if there is a new `loader` or`action` or `documentRequest` after build.
423
423
// We should be able to wrap them, as they may not be wrapped before.
424
- if ( ! ( wrappedEntry . module . default as WrappedFunction ) . __sentry_original__ ) {
424
+ const defaultExport = wrappedEntry . module . default as undefined | WrappedFunction ;
425
+ if ( defaultExport && ! defaultExport . __sentry_original__ ) {
425
426
fill ( wrappedEntry . module , 'default' , makeWrappedDocumentRequestFunction ) ;
426
427
}
427
428
428
429
for ( const [ id , route ] of Object . entries ( build . routes ) ) {
429
430
const wrappedRoute = { ...route , module : { ...route . module } } ;
430
431
431
- if ( wrappedRoute . module . action && ! ( wrappedRoute . module . action as WrappedFunction ) . __sentry_original__ ) {
432
+ const routeAction = wrappedRoute . module . action as undefined | WrappedFunction ;
433
+ if ( routeAction && ! routeAction . __sentry_original__ ) {
432
434
fill ( wrappedRoute . module , 'action' , makeWrappedAction ( id ) ) ;
433
435
}
434
436
435
- if ( wrappedRoute . module . loader && ! ( wrappedRoute . module . loader as WrappedFunction ) . __sentry_original__ ) {
437
+ const routeLoader = wrappedRoute . module . loader as undefined | WrappedFunction ;
438
+ if ( routeLoader && ! routeLoader . __sentry_original__ ) {
436
439
fill ( wrappedRoute . module , 'loader' , makeWrappedLoader ( id ) ) ;
437
440
}
438
441
You can’t perform that action at this time.
0 commit comments