t-comm
Version:
专业、稳定、纯粹的工具库
22 lines (18 loc) • 548 B
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
/**
* 获取 Node.js path 模块
* 动态导入 path 模块,避免在浏览器环境中引起错误
* @returns Node.js path 模块
* @example
* ```ts
* const path = getPath();
* const fullPath = path.resolve(__dirname, './file.txt');
* const basename = path.basename('/path/to/file.txt'); // 'file.txt'
* ```
*/
function getPath() {
// eslint-disable-next-line @typescript-eslint/no-require-imports
return require('path');
}
exports.getPath = getPath;