📜  __filename 未在 mjs 文件中定义 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:37.290000             🧑  作者: Mango

代码示例1
// to replicate in .mjs files or files of type "module" in Node

import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);