fix(auth): Aliyun SMS 用 require() 替代 import() 避免 TS2307
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
9eb35e5f1e
commit
6d3d45a4fb
|
|
@ -70,14 +70,11 @@ export class AliyunSmsProvider implements ISmsProvider {
|
||||||
private async getClient() {
|
private async getClient() {
|
||||||
if (this.client) return this.client;
|
if (this.client) return this.client;
|
||||||
|
|
||||||
// 动态导入 (仅生产环境需要, 开发环境不安装这些包)
|
// 动态 require (仅 SMS_ENABLED=true 时调用, 开发环境不安装这些包)
|
||||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||||
const { default: Dysmsapi20170525 } = await (import(
|
const Dysmsapi20170525 = require('@alicloud/dysmsapi20170525').default;
|
||||||
/* webpackIgnore: true */ '@alicloud/dysmsapi20170525'
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||||
) as any);
|
const { Config } = require('@alicloud/openapi-client');
|
||||||
const { Config } = await (import(
|
|
||||||
/* webpackIgnore: true */ '@alicloud/openapi-client'
|
|
||||||
) as any);
|
|
||||||
|
|
||||||
const config = new Config({
|
const config = new Config({
|
||||||
accessKeyId: process.env.ALIYUN_ACCESS_KEY_ID,
|
accessKeyId: process.env.ALIYUN_ACCESS_KEY_ID,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue