From 641355083cdd6393612668c157646b66c8e09276 Mon Sep 17 00:00:00 2001 From: xiaoxian521 <1923740402@qq.com> Date: Thu, 17 Nov 2022 18:54:09 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=85=BC=E5=AE=B9=E5=BC=95=E5=85=A5?= =?UTF-8?q?=E6=9F=90=E4=B8=AA=E5=BA=93=E5=AF=BC=E8=87=B4=20`global=20is=20?= =?UTF-8?q?not=20defined`=20=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/globalPolyfills.ts | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 src/utils/globalPolyfills.ts diff --git a/src/utils/globalPolyfills.ts b/src/utils/globalPolyfills.ts new file mode 100644 index 000000000..e9bc9a85f --- /dev/null +++ b/src/utils/globalPolyfills.ts @@ -0,0 +1,7 @@ +// 如果项目出现 `global is not defined` 报错,可能是您引入某个库的问题,比如 aws-sdk-js https://github.com/aws/aws-sdk-js +// 解决办法就是将该文件引入 src/main.ts 即可 import "@/utils/globalPolyfills"; +if (typeof (window as any).global === "undefined") { + (window as any).global = window; +} + +export {};