Isomorphic `__dirname`
Read OriginalThis technical article explains how to create an isomorphic __dirname variable that works in both ESM (where __dirname is not available) and CommonJS modules. It provides a code snippet using Node.js's path and url modules, specifically useful for developers writing TypeScript code transpiled to both formats with tools like tsup.
Comments
No comments yet
Be the first to share your thoughts!
Browser Extension
Get instant access to AllDevBlogs from your browser