File tree 2 files changed +9
-8
lines changed
2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -71,14 +71,15 @@ type EndpointInfo = {
71
71
reconnect ?( ) : ActionOnLostSubscription | void ;
72
72
} ;
73
73
74
- const initAtmosphere = async ( ) => {
75
- if ( ! import . meta. env . VITE_SW_CONTEXT ) {
76
- return await import ( 'atmosphere.js' ) . then ( ( module ) => module . default ) ;
77
- }
78
- return undefined ;
79
- } ;
74
+ let atmosphere : Atmosphere . Atmosphere | undefined ;
80
75
81
- const atmosphere : Atmosphere . Atmosphere | undefined = await initAtmosphere ( ) ;
76
+ ( async ( ) => {
77
+ if ( ! import . meta. env ?. VITE_SW_CONTEXT ) {
78
+ atmosphere = await import ( 'atmosphere.js' ) . then ( ( module ) => module . default ) ;
79
+ }
80
+ } ) ( ) . catch ( ( e ) => {
81
+ console . error ( 'Failed to load atmosphere.js' , e ) ;
82
+ } ) ;
82
83
83
84
/**
84
85
* A representation of the underlying persistent network connection used for subscribing to Flux type endpoint methods.
Original file line number Diff line number Diff line change @@ -6,5 +6,5 @@ interface ImportMetaEnv {
6
6
}
7
7
8
8
interface ImportMeta {
9
- readonly env : ImportMetaEnv ;
9
+ readonly env ? : ImportMetaEnv ;
10
10
}
You can’t perform that action at this time.
0 commit comments