4 ms·
FWIW, you can replace __dirname with information from import.meta (and 2 lines of JS). It’s not quite as automagic but can yield the exact same info. You’re als
by merrywhether 5y ago
FWIW, you can replace __dirname with information from import.meta (and 2 lines of JS). It’s not quite as automagic but can yield the exact same info. You’re also right that it might just be a code-smell in general though.
- franciscop 5y agoYeah, I've had 2 layers of deception there. You think it might be those 2-3 lines from the popular StackOverflow answer, but after hunting a bug for a while I realized that it was url-encoding that space in the path name and saying "directory doesn't exist" when in the console it was obviously correct. Drove me crazy until I realized in the full path there was, early in the path, a single "%20" and my JS senses told me it doesn't make sense for spaces to be url-encoded in paths.