Skip to content

引入

ts
import { getDeps } from 't-comm';

// 不支持 tree-shaking 的项目
import { getDeps} from 't-comm/lib/rollup/index';

// 只支持 ESM 的项目
import { getDeps} from 't-comm/es/rollup/index';

getDeps(dir)

描述:获取依赖列表

参数

参数名描述
dir目录

返回: dependenciesList

示例

ts
// 假设 ./package.json 中 dependencies 包含 axios、lodash
getDeps('./');
// ['axios', 'lodash']