From 61c79bb0e7fac622b246a68772680402451abbf9 Mon Sep 17 00:00:00 2001 From: Clansty Date: Sat, 26 Feb 2022 00:33:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AF=BC=E5=85=A5=20file-type=20?= =?UTF-8?q?=E6=97=B6=E5=87=BA=E9=94=99=20https://github.com/microsoft/Type?= =?UTF-8?q?Script/issues/43329?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/helpers/forwardHelper.ts | 2 +- tsconfig.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/helpers/forwardHelper.ts b/src/helpers/forwardHelper.ts index 3528db0..685a2ed 100644 --- a/src/helpers/forwardHelper.ts +++ b/src/helpers/forwardHelper.ts @@ -8,7 +8,7 @@ const log = getLogger('ForwardHelper'); export default { async downloadToCustomFile(url: string) { - const { fileTypeFromBuffer } = await import('file-type'); + const { fileTypeFromBuffer } = await (Function('return import("file-type")')() as Promise); const file = await fetchFile(url); const type = await fileTypeFromBuffer(file); return new CustomFile(`image.${type.ext}`, file.length, '', file); diff --git a/tsconfig.json b/tsconfig.json index 1d18425..67e88d9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "module": "CommonJS", + "module": "nodenext", "target": "ESNext", "esModuleInterop": true, "sourceMap": false,