Bun

指南实用程序

使用 Bun 获取当前文件的绝对路径

Bun 在 import.meta 对象上提供了少量特定于模块的实用程序。使用 import.meta.path 来检索当前文件的绝对路径。

/a/b/c.ts
import.meta.path; // => "/a/b/c.ts"

有关完整的文档,请参阅 文档 > API > import.meta