浏览代码

fix(CRA@4): import hack

Closes #954
Jonas Gloning 3 年之前
父节点
当前提交
41c3ba7b2c
共有 1 个文件被更改,包括 11 次插入7 次删除
  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()}`;
 	}
 })();