语言JS 文档JS兼容ES 中使用 node 的 __filename 和 __dirnameES 中使用 node 的 __filename 和 __dirname import path from 'path'; import { fileURLToPath } from 'url'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename);