Answers for "__filename not defined in mjs files"

0

__filename not defined in mjs files

// 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);
Posted by: Guest on May-22-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language