Browse Source

fix(CRA@4): import hack

Closes #954
Jonas Gloning 3 years ago
parent
commit
41c3ba7b2c
1 changed files with 11 additions and 7 deletions
  1. 11 7
      lib/supports.ts

+ 11 - 7
lib/supports.ts

@@ -1,4 +1,8 @@
-import webRTCAdapter from "webrtc-adapter";
+import webRTCAdapter_import from "webrtc-adapter";
+
+const webRTCAdapter: typeof webRTCAdapter_import =
+	//@ts-ignore
+	webRTCAdapter_import.default || webRTCAdapter_import;
 
 export const Supports = new (class {
 	readonly isIOS = ["iPad", "iPhone", "iPod"].includes(navigator.platform);
@@ -66,12 +70,12 @@ export const Supports = new (class {
 	}
 
 	toString(): string {
-		return `Supports: 
-    browser:${this.getBrowser()} 
-    version:${this.getVersion()} 
-    isIOS:${this.isIOS} 
-    isWebRTCSupported:${this.isWebRTCSupported()} 
-    isBrowserSupported:${this.isBrowserSupported()} 
+		return `Supports:
+    browser:${this.getBrowser()}
+    version:${this.getVersion()}
+    isIOS:${this.isIOS}
+    isWebRTCSupported:${this.isWebRTCSupported()}
+    isBrowserSupported:${this.isBrowserSupported()}
     isUnifiedPlanSupported:${this.isUnifiedPlanSupported()}`;
 	}
 })();