TencentCloudBase / cloudbase-manager-node

The node cloudbase manager tool
ISC License
18 stars 5 forks source link

无法在nestjs中使用 #31

Closed GiantappMan closed 2 years ago

GiantappMan commented 2 years ago

重现步骤

nest new tcb-test
yarn add @cloudbase/node-sdk
yarn add @cloudbase/manager-node

//main.ts
import CloudBase from '@cloudbase/manager-node';
import tcb from '@cloudbase/node-sdk';
console.log('tcb:', tcb);
console.log('CloudBase:', CloudBase);

//输出
// tcb: undefined
// CloudBase: undefined

image image

GiantappMan commented 2 years ago

tcb-nest-test.zip

juukee commented 2 years ago
import CloudBase = require("@cloudbase/manager-node");
GiantappMan commented 2 years ago

require 可以,官方还是支持一下标准写法吧

juukee commented 2 years ago

1648179367(1) 我在非nestjs框架里面又可以运行官方示例代码...

GiantappMan commented 2 years ago

nest 确实不行,等戴佬出来讲讲吧

juukee commented 2 years ago

tsconfig.json

"esModuleInterop": true,

加一条这个设置解决问题

GiantappMan commented 2 years ago

tsconfig.json

"esModuleInterop": true,

加一条这个设置解决问题

666