Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

__dir name in ESM module

import * as url from 'url';
    const __filename = url.fileURLToPath(import.meta.url);
    const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
Source by blog.logrocket.com #
 
PREVIOUS NEXT
Tagged: #ESM #module
ADD COMMENT
Topic
Name
3+8 =