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 {
421421 // Because the build can change between build and runtime.
422422 // So if there is a new `loader` or`action` or `documentRequest` after build.
423423 // 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__ ) {
425426 fill ( wrappedEntry . module , 'default' , makeWrappedDocumentRequestFunction ) ;
426427 }
427428
428429 for ( const [ id , route ] of Object . entries ( build . routes ) ) {
429430 const wrappedRoute = { ...route , module : { ...route . module } } ;
430431
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__ ) {
432434 fill ( wrappedRoute . module , 'action' , makeWrappedAction ( id ) ) ;
433435 }
434436
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__ ) {
436439 fill ( wrappedRoute . module , 'loader' , makeWrappedLoader ( id ) ) ;
437440 }
438441
You can’t perform that action at this time.
0 commit comments