UNPKG

@nestjs/core

Version:

The core of NestJS, a TypeScript framework for Node.js backends: modules, dependency injection and the request pipeline, on Express, Fastify or node:http.

9 lines (8 loc) • 194 B
export async function optionalRequire(packageName, loaderFn) { try { return loaderFn ? await loaderFn() : await import(packageName); } catch (e) { return {}; } }