From 6d3d45a4fbfe0625d1ac9fc37c06752a2be53bb4 Mon Sep 17 00:00:00 2001 From: hailin Date: Mon, 23 Feb 2026 22:11:14 -0800 Subject: [PATCH] =?UTF-8?q?fix(auth):=20Aliyun=20SMS=20=E7=94=A8=20require?= =?UTF-8?q?()=20=E6=9B=BF=E4=BB=A3=20import()=20=E9=81=BF=E5=85=8D=20TS230?= =?UTF-8?q?7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.6 --- .../src/infrastructure/sms/aliyun-sms.provider.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/backend/services/auth-service/src/infrastructure/sms/aliyun-sms.provider.ts b/backend/services/auth-service/src/infrastructure/sms/aliyun-sms.provider.ts index 8d87bc3..f6ca5b7 100644 --- a/backend/services/auth-service/src/infrastructure/sms/aliyun-sms.provider.ts +++ b/backend/services/auth-service/src/infrastructure/sms/aliyun-sms.provider.ts @@ -70,14 +70,11 @@ export class AliyunSmsProvider implements ISmsProvider { private async getClient() { if (this.client) return this.client; - // 动态导入 (仅生产环境需要, 开发环境不安装这些包) + // 动态 require (仅 SMS_ENABLED=true 时调用, 开发环境不安装这些包) // eslint-disable-next-line @typescript-eslint/no-var-requires - const { default: Dysmsapi20170525 } = await (import( - /* webpackIgnore: true */ '@alicloud/dysmsapi20170525' - ) as any); - const { Config } = await (import( - /* webpackIgnore: true */ '@alicloud/openapi-client' - ) as any); + const Dysmsapi20170525 = require('@alicloud/dysmsapi20170525').default; + // eslint-disable-next-line @typescript-eslint/no-var-requires + const { Config } = require('@alicloud/openapi-client'); const config = new Config({ accessKeyId: process.env.ALIYUN_ACCESS_KEY_ID,