Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

es module __dirname alternative

import { dirname } from 'path';
import { fileURLToPath } from 'url';

const __dirname = dirname(fileURLToPath(import.meta.url));
Comment

__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));
Comment

PREVIOUS NEXT
Code Example
Javascript :: generate random character in javascript 
Javascript :: js get query param 
Javascript :: local storage check if key exists 
Javascript :: convert hexadecimal to decimal js 
Javascript :: vanilla js on click 
Javascript :: one year ago javascript date 
Javascript :: javascript random number between 1 and 10 
Javascript :: how to get value and key in a for of loop in js 
Javascript :: slugify text javascript 
Javascript :: one line uuid 
Javascript :: on resize jquery 
Javascript :: javascript replace space by underscore 
Javascript :: js replace quotes 
Javascript :: Bootstrap jquery popper and js cdn 
Javascript :: copy a file and paste with fs 
Javascript :: install react 
Javascript :: javascript how to check for an empty object 
Javascript :: display none js 
Javascript :: jquery disable class attribute 
Javascript :: acces store from vue console javascript 
Javascript :: object to url params js 
Javascript :: jquery prevent event bubbling 
Javascript :: javascript remove all whitespaces 
Javascript :: jquery click or touch 
Javascript :: javascript time execution 
Javascript :: angular pipe first letter uppercase 
Javascript :: token invalid discord bot 
Javascript :: javascript array split chunk 
Javascript :: remove special characters regular expression 
Javascript :: × MUI: makeStyles is not longer exported from @mui/material/styles. You have to import it from @mui/styles. 
ADD CONTENT
Topic
Content
Source link
Name
1+4 =