From 25134c6ac6ee4c0c786387b069b3478fe7c1ba0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Sun, 26 May 2024 20:38:18 +0800 Subject: [PATCH] fix: vite-env --- src/onebot11/main.ts | 5 ++++- src/vite-env.d.ts | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 src/vite-env.d.ts diff --git a/src/onebot11/main.ts b/src/onebot11/main.ts index 0fb32287..8833a497 100644 --- a/src/onebot11/main.ts +++ b/src/onebot11/main.ts @@ -110,7 +110,10 @@ export class NapCatOnebot11 { // } // }; try { - //console.log(buf2hex(Buffer.from(protobufData))); + // 生产环境会自己去掉 + if (import.meta.env.MODE == 'development') { + console.log(buf2hex(Buffer.from(protobufData))); + } const sysMsg = SysData.fromBinary(Buffer.from(protobufData)); const peeruin = sysMsg.header[0].peerNumber; const peeruid = sysMsg.header[0].peerString; diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts new file mode 100644 index 00000000..d07ff4dc --- /dev/null +++ b/src/vite-env.d.ts @@ -0,0 +1,10 @@ +/// + +interface ImportMetaEnv { + readonly VITE_APP_TITLE: string + // 更多环境变量... + } + + interface ImportMeta { + readonly env: ImportMetaEnv + } \ No newline at end of file