We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When the dual build is CJS
import.meta.url
require('url').pathToFileURL(__filename).toString()
When the dual build is ESM
__filename
import.meta.filename
fileURLToPath(import.meta.url)
__dirname
import.meta.dirname
dirname(fileURLToPath(import.meta.url))
https://nodejs.org/api/esm.html#no-__filename-or-__dirname
The text was updated successfully, but these errors were encountered:
Interesting tsc behavior filed in TypeScript/58658.
tsc
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
When the dual build is CJS
import.meta.url
with something likerequire('url').pathToFileURL(__filename).toString()
.When the dual build is ESM
__filename
withimport.meta.filename
orfileURLToPath(import.meta.url)
. The latter option allows supporting older node versions.__dirname
withimport.meta.dirname
ordirname(fileURLToPath(import.meta.url))
.https://nodejs.org/api/esm.html#no-__filename-or-__dirname
The text was updated successfully, but these errors were encountered: