Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

__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);
 
PREVIOUS NEXT
Tagged: #defined #mjs #files
ADD COMMENT
Topic
Name
8+3 =